Uh oh!
There was an error while loading. Please reload this page.
http: response should always emit close on finish - #20043
Conversation
trivikr
commented
Apr 15, 2018
trivikr
commented
Apr 15, 2018
Rerun for node-test-commit-freebsd https://ci.nodejs.org/job/node-test-commit-freebsd/17043/ |
| if (res) { | ||
| if (res.readable) { | ||
| // Socket closed before we emitted 'end' below. | ||
| res.emit('aborted'); |
There was a problem hiding this comment.
The !req.res.complete condition is gone, is this wanted?
There was a problem hiding this comment.
Is there any edit required here?
There was a problem hiding this comment.
It should have if (!req.res.complete) req.res.emit('aborted');. I would check the rest too. There have been changes to that part of code since that original PR was started.
| if (!req.res.complete) req.res.emit('aborted'); | ||
| var res = req.res; | ||
| res.on('end', function() { | ||
| var res = req.res; |
apapirovski
commented
Apr 15, 2018
This will need CITGM run and also, if we don't have something like |
BridgeAR
commented
Apr 15, 2018
BridgeAR
commented
Apr 15, 2018
I think we need to handle the if(res){// *******// NOTE: if `req.emit('response')` has been emitted we must always emit `aborted`, regardless of whether the response is readable or not.// Socket closed before we emitted 'end' below.if(!res.complete){res.emit('aborted');}// *******if(res.readable){res.on('end',function(){res.emit('close');});res.push(null);}else{res.emit('close');}} |
Should we make the order of This would avoid intermittent bugs in code that depend on the order. if(res){if(res.readable){// Socket closed before we emitted 'end' below.if(!res.complete){res.emit('aborted');}req.emit('close');// !! Emit close before or after aborted?res.on('end',function(){res.emit('close');});res.push(null);}else{req.emit('close');// !!res.emit('close');}}elseif(!req.socket._hadError){// This socket error fired before we started to// receive a response. The error needs to// fire on the request.req.socket._hadError=true;req.emit('error',createHangUpError());req.emit('close');// !!}else{req.emit('close');// !!} |
ronag
commented
Apr 16, 2018
#20075, feel free to cherry-pick |
BridgeAR
commented
Apr 23, 2018
Ping @trivikr |
Fixes: #17352
Original PR was posted at #17397
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes