You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
end after write stops http2 stream with trailers ending #41898
Linux david-Latitude-E6440 5.13.0-22-generic #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
http2
What steps will reproduce the bug?
Run this program:
const{ createServer, connect }=require('http2');constassert=require('assert');createServer().on('stream',function(stream){stream.respond({':status': 200,'Content-Type': 'application/octet-stream'});stream.on('end',()=>{stream.end();stream.session.close();this.close();});stream.resume();}).listen(7000,()=>{connect('http://localhost:7000',function(){this.request({':method': 'POST'},{waitForTrailers: true}).on('response',function(){this.end('12345');this.on('error',err=>assert.equal(err.message,'write after end'));this.write('6');}).on('wantTrailers',function(){this.sendTrailers({});});});});
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior?
Program should exit
What do you see instead?
Program doesn't exit because server stream doesn't get end event.
Additional information
If you remove the write after end (this.write('6')) then the program exits.
Something is stopping the wantTrailers event being emitted and so the client stream never ends.
Note, changing to waitForTrailers: false also makes it exit (server gets end event).
Activity
davedoesdev commentedon Feb 8, 2022
OK I guess this is expected behaviour due to 7a7ba82
davedoesdev commentedon Feb 8, 2022
Just not sure that an error which occurs after ending the stream should cause the stream not to end.
benjamingr commentedon Feb 16, 2022
@ronag can you confirm this is expected?
ronag commentedon Feb 16, 2022
This is expected behavior.