New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: fix res emit close before user finish #20941

Closed
wants to merge 1 commit into
base: master
from

Conversation

@ronag
Contributor

ronag commented May 24, 2018

Fixes a regression caused by #20611 which breaks eos, pump and pumpify.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
@ronag

This comment has been minimized.

Contributor

ronag commented May 24, 2018

@jasnell @trivikr This is potentially urgent for a 10.2.1?

@ronag

This comment has been minimized.

Contributor

ronag commented May 24, 2018

Another possible solution is to use prefinish instead of finish for resOnFinish but I'm unsure about the ramifications of that. This solution is safer.

@mafintosh

This comment has been minimized.

Member

mafintosh commented May 24, 2018

@ronag Thanks for the quick fix :)

@mafintosh

This comment has been minimized.

Member

mafintosh commented May 24, 2018

This is def urgent for a 10.2.1 - without this fix end-of-stream, pump and most userland stream stuff using those are broken when using http streams

@@ -562,7 +562,7 @@ function resOnFinish(req, res, socket, state, server) {
res.detachSocket(socket);
req.emit('close');
res.emit('close');
process.nextTick(emitCloseNT.bind(res));

This comment has been minimized.

@mafintosh

mafintosh May 24, 2018

Member

You could also do process.nextTick(emitCloseNT, res) to avoid the bind and accept res as an arg in your emitCloseNT function

This comment has been minimized.

@mcollina

mcollina May 24, 2018

Member

this will be better.

@jasnell

This comment has been minimized.

Member

jasnell commented May 24, 2018

@mafintosh

This comment has been minimized.

@jasnell jasnell added the fast-track label May 24, 2018

@mcollina

LGTM

@mcollina

This comment has been minimized.

Member

mcollina commented May 24, 2018

+1 to fast tracking.

res.on('finish', common.mustCall((() => {
assert.strictEqual(resClosed, false);
})));
res.on('close', common.mustCall((() => {

This comment has been minimized.

@mafintosh

mafintosh May 24, 2018

Member

you have an unneeded paran around the arrow fn here which the linter complains about

This comment has been minimized.

@MylesBorins

MylesBorins May 24, 2018

Member

if everything else is green I'll go ahead and fix that while landing

@ronag

This comment has been minimized.

Contributor

ronag commented May 24, 2018

Fixed comments.

@jasnell

This comment has been minimized.

Member

jasnell commented May 24, 2018

The other fix for 10.2.1 has been landed. As soon as this one lands we should be ready to go for 10.2.1

@MylesBorins

This comment has been minimized.

Member

MylesBorins commented May 24, 2018

Kicked off another CI based on new changes

https://ci.nodejs.org/job/node-test-commit/18750/

@BridgeAR

LGTM but the comment should be addressed (it could also be removed while landing).

})));
res.on('close', common.mustCall(() => {
resClosed = true;
// assert.strictEqual(res._writableState.ended, true);

This comment has been minimized.

@BridgeAR

BridgeAR May 24, 2018

Member

Please remove commented code.

@MylesBorins

This comment has been minimized.

Member

MylesBorins commented May 24, 2018

The failures on arm will all infra related. I've fixed the linting error and removed comment when landing.

landed in 8ce20af

MylesBorins added a commit that referenced this pull request May 24, 2018

http: fix res emit close before user finish
PR-URL: #20941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

MylesBorins added a commit that referenced this pull request May 24, 2018

http: fix res emit close before user finish
PR-URL: #20941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

@MylesBorins MylesBorins referenced this pull request May 24, 2018

Merged

v10.2.1 proposal #20943

@mafintosh

This comment has been minimized.

Member

mafintosh commented May 24, 2018

Thanks everyone

shisama added a commit to shisama/node that referenced this pull request May 30, 2018

http: fix res emit close before user finish
PR-URL: nodejs#20941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

shisama added a commit to shisama/node that referenced this pull request May 30, 2018

http: fix res emit close before user finish
PR-URL: nodejs#20941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

shisama added a commit to shisama/node that referenced this pull request Jun 5, 2018

http: fix res emit close before user finish
PR-URL: nodejs#20941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

hekike added a commit to restify/node-restify that referenced this pull request Jun 6, 2018

shisama added a commit to shisama/node that referenced this pull request Jun 9, 2018

http: fix res emit close before user finish
PR-URL: nodejs#20941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

shisama added a commit to shisama/node that referenced this pull request Jun 11, 2018

http: fix res emit close before user finish
PR-URL: nodejs#20941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

shisama added a commit to shisama/node that referenced this pull request Jun 12, 2018

http: fix res emit close before user finish
PR-URL: nodejs#20941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

shisama added a commit to shisama/node that referenced this pull request Jun 17, 2018

http: fix res emit close before user finish
PR-URL: nodejs#20941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

@targos targos added this to Don't land (for now) in v10.x Sep 23, 2018

@targos targos moved this from Don't land (for now) to Don't land (ever) in v10.x Sep 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment