-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
http2Issues or PRs related to the http2 subsystem.Issues or PRs related to the http2 subsystem.
Description
Version: 8.8.1
Platform: 64bit linux
Subsystem: http2
I'm trying to write a simple nghttpx clone, so you see stream.respond & pipe there.
I was finding the right way to destroy the httpres and the stream.
I'm sorry that I don't know how to reliable reproduce this.
exceptions found:
internal/http2/core.js:1355
const handle = session[kHandle];
^
TypeError: Cannot read property 'Symbol(handle)' of undefined
at ServerHttp2Stream._write (internal/http2/core.js:1355:27)
at doWrite (_stream_writable.js:387:12)
at clearBuffer (_stream_writable.js:514:7)
at onwrite (_stream_writable.js:439:7)
at WriteWrap.afterDoStreamWrite [as oncomplete] (internal/http2/core.js:1157:9)
at Immediate.finishStreamDestroy [as _onImmediate] (internal/http2/core.js:1534:12)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:747:5)
at processImmediate [as _immediateCallback] (timers.js:718:5)
and this
(maybe caused by stream.rstStream(http2.constants.NGHTTP2_CONNECT_ERROR);)
internal/http2/core.js:1377
const handle = session[kHandle];
^
TypeError: Cannot read property 'Symbol(handle)' of undefined
at ServerHttp2Stream._writev (internal/http2/core.js:1377:27)
at doWrite (_stream_writable.js:385:12)
at clearBuffer (_stream_writable.js:491:5)
at onwrite (_stream_writable.js:439:7)
at WriteWrap.afterDoStreamWrite [as oncomplete] (internal/http2/core.js:1157:9)
at Immediate.finishStreamDestroy [as _onImmediate] (internal/http2/core.js:1534:12)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:747:5)
at processImmediate [as _immediateCallback] (timers.js:718:5)
snippet:
const server = http2.createServer();
server.on('stream', (stream, headers) => {
// ... here is the request
var httpreq = http.request(parsed, function(httpres) {
httpres.headers[':status'] = httpres.statusCode;
delete httpres.headers['connection'];
delete httpres.headers['keep-alive'];
delete httpres.headers['proxy-connection'];
delete httpres.headers['host'];
delete httpres.headers['upgrade'];
delete httpres.headers['transfer-encoding'];
// Note: this is issue 16452
if (httpres.headers['set-cookie'] && httpres.headers['set-cookie'].length ==
1) {
httpres.headers['set-cookie'] = httpres.headers['set-cookie'][0];
}
stream.respond(httpres.headers);
httpres.pipe(stream, {end: true});
});
httpreq.on('error', (error) => {
if (!stream.headersSent && !stream.destroyed) {
stream.respond({':status': 502});
stream.end('502 Error');
} else if (!stream.destroyed) {
httpreq.abort();
stream.destroy();
}
});
stream.on('error', (error) => {
httpreq.abort();
});
stream.on('aborted', () => { httpreq.abort() });
stream.on('streamClosed', () => { httpreq.abort() });
stream.pipe(httpreq, {end: true});
}
Metadata
Metadata
Assignees
Labels
http2Issues or PRs related to the http2 subsystem.Issues or PRs related to the http2 subsystem.