Skip to content

The HTTP2 streams sometimes don't emit the end event #32978

Closed
@szmarczak

Description

@szmarczak
  • Version: v13.13.0
  • Platform: Linux solus 5.5.11-151.current deps: update openssl to 1.0.1j #1 SMP PREEMPT Tue Mar 24 18:06:46 UTC 2020 x86_64 GNU/Linux
  • Subsystem: http2

What steps will reproduce the bug?

const {connect} = require('http2');
const session = connect('https://www.facebook.com');
session.once('remoteSettings', () => {
	console.log('got settings');
	session.request({
		'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36',
		'accept-encoding': 'gzip, deflate, br'
	}).once('response', headers => {
		console.log('got headers', headers);
	}).on('data', chunk => {
		console.log(chunk.toString().length);
	}).on('end', () => {
		console.log('got end');
	}).resume();
});

How often does it reproduce? Is there a required condition?

It reproduces 80% of the time. Sometimes it emits the end event as expected.

What is the expected behavior?

got settings
got headers [Object: null prototype] { ... }
[numbers here]
+got end

What do you see instead?

got settings
got headers [Object: null prototype] { ... }
[numbers here]

Additional information

curl works as expected:

curl --http2 -H 'accept-encoding: gzip, deflate, br' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36' https://www.facebook.com>/dev/null

First discovered by @kaatt szmarczak/http2-wrapper#38

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues or PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions