Description
- Version: 14.16.0, 15.12.0
- Platform: 18.7.0 Darwin Kernel Version 18.7.0: Mon Aug 31 20:53:32 PDT 2020; root:xnu-4903.278.44~1/RELEASE_X86_64 x86_64
- Subsystem: http2
What steps will reproduce the bug?
async function main() {
const client = http2.connect('https://www.postgresql.org');
const stream = client.request({
':method': 'GET',
':path': '/',
'accept-encoding': 'gzip, deflate, br',
});
const buffer: Buffer[] = [];
for await (const data of stream) {
buffer.push(data);
}
const response = Buffer.concat(buffer).toString();
console.log(response);
}
main().catch(err => console.log('Http2 User Error', err));
How often does it reproduce? Is there a required condition?
It will happen every time. When looking deeper into http2 frames, it appears the use of the Varnish? gzip module on the end site is causing an EOF frame to be incorrectly sent. nghttp2 treats any http2 violation as fatal, and so does nodejs.
What is the expected behavior?
Ideally, there would be a way to allow the code to continue since this is really just an invalid EOF code. Chrome's handling of http2 seems to handle this fine. They're obviously more interested in a lenient solution to http2 errors than nodejs.
If there's not a way to provide a lenient mode, or to decide what to do in the case of frame errors, I would have expected this to throw a more descriptive error that says something about the end site having an invalid http2 implementation.
What do you see instead?
The following are a snippet of running the example with NODE_DEBUG=http2*,stream* NODE_DEBUG_NATIVE=http2
STREAM 3518: need readable true
STREAM 3518: length less than watermark true
STREAM 3518: do read
HttpStream 1 (23) [Http2Session client (19)] reading starting
STREAM 3518: read undefined
STREAM 3518: need readable true
STREAM 3518: length less than watermark true
STREAM 3518: reading or ended false
STREAM 3518: read undefined
STREAM 3518: need readable true
STREAM 3518: length less than watermark true
STREAM 3518: reading or ended false
Http2Session client (19) complete frame received: type: 0
Http2Session client (19) handling data frame for stream 1
Http2Session client (19) complete frame received: type: 0
Http2Session client (19) handling data frame for stream 1
Http2Session client (19) fatal error receiving data: -902
HTTP2 3518: Http2Session client: destroying
HTTP2 3518: Http2Session client: start closing/destroying Error [ERR_HTTP2_ERROR]: The user callback function failed
at Http2Session.onSessionInternalError (internal/http2/core.js:751:26) {
code: 'ERR_HTTP2_ERROR',
errno: -902
}
HTTP2 3518: Http2Stream 1 [Http2Session client]: destroying stream
Activity