nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
107.81k stars 29.71k forks source link

http2: calling ServerHttp2Stream end() can silently fail #35409

Open kanongil opened 4 years ago

kanongil commented 4 years ago

What steps will reproduce the bug?

const http2 = require('http2');

const server = http2.createServer({
  host: '127.0.0.1'
});

server.on('stream', (stream, headers) => {
  //stream.respond({ ':status': 200 });
  stream.end(() => console.log('FINISHED')); // nothing is ever sent!!
});

server.listen(0, () => {
  const client = http2.connect(`http://localhost:${server.address().port}/`);
  const req = client.request();
  req.on('aborted', () => console.log('ABORTED'));
  req.on('aborted', () => console.log('CLOSE'));
});

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

Always, for server streams where stream.respond() has not been called.

What is the expected behavior?

Not being ignored, eg. a thrown error / server stream emitted error / a response with code 200.

What do you see instead?

stream.end() calls its callback, but nothing really happens!

Additional information

A wireshark capture shows that the server never sends a response.

Vboivin commented 4 years ago

@Himself65 I will work on this issue

himself65 commented 4 years ago

@Himself65 I will work on this issue

nice

Vboivin commented 4 years ago

I took a look at these method calls:

None of them seem to solve the problem so far. I am still working on it, but if someone wants to help, it would be appreciated!