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
http2: close not emitted when receiving RST_STREAM after DATA #27863
Platform: Linux 4.4.0-142-generic 168-Ubuntu SMP Wed Jan 16 2019 x86_64 GNU/Linux
Subsystem: http2
constserver=http2.createServer();server.on('stream',(stream)=>{stream.respond();stream.write('test');// Wait for DATA to be sent, then send RST_STREAMsetTimeout(()=>stream.close(),200);});server.listen(()=>{constclient=http2.connect({protocol: 'http:', ...server.address()});constreq=client.request({':path': '/'});req.end();req.on('close',()=>{// Never called});});
I can verify that RST_STREAM is sent to the client, but close is never emitted. Is this expected?
If the write is removed, close is emitted.
...I feel a bit stupid. After #17406, the stream isn't destroyed immediately upon receiving an RST_STREAM, it's destroyed after all data has been consumed. Hence, doing req.resume() on the above example makes it emit the close event.
I think we should at least clarify the docs. Also, test-http2-large-write-destroy.js should be corrected to add req.resume(), unless I'm missing something.
Activity
mildsunrise commentedon May 26, 2019
I have bisected this to #17406, to the second commit.
Relevant diffs: lib/internal/http2/core.js and src/node_http2.cc
mildsunrise commentedon May 26, 2019
...I feel a bit stupid. After #17406, the stream isn't destroyed immediately upon receiving an RST_STREAM, it's destroyed after all data has been consumed. Hence, doing
req.resume()on the above example makes it emit thecloseevent.I think we should at least clarify the docs. Also,
test-http2-large-write-destroy.jsshould be corrected to addreq.resume(), unless I'm missing something.lpinca commentedon May 26, 2019
Yes, seems correct to me.
doc,test: clarify that Http2Stream is destroyed after data is read
Trott commentedon May 28, 2019
Fixed in 42d8011
doc,test: clarify that Http2Stream is destroyed after data is read
doc,test: clarify that Http2Stream is destroyed after data is read
doc,test: clarify that Http2Stream is destroyed after data is read