Skip to content

HTTP outgoing queue bug fix (#2639)#3068

Closed
mareksrom wants to merge 1 commit into
nodejs:masterfrom
mareksrom:patch-1
Closed

HTTP outgoing queue bug fix (#2639)#3068
mareksrom wants to merge 1 commit into
nodejs:masterfrom
mareksrom:patch-1

Conversation

@mareksrom

Copy link
Copy Markdown

This change fix bug of incorrect http outgoing queue which caused crash on assert. I think there should be some other changes to make ending of response more transparent, this change only fix the bug.

This change fix bug of incorrect http outgoing queue which caused crash on assert. I think there should be some other changes to make ending of response more transparent, this change only fix the bug.
@mscdex mscdex added the http Issues or PRs related to the http subsystem. label Sep 25, 2015
@tflanagan

Copy link
Copy Markdown
Contributor

Dup of #3059?

@indutny

indutny commented Sep 25, 2015

Copy link
Copy Markdown
Member

@tflanagan it is not a dup.

@indutny

indutny commented Sep 25, 2015

Copy link
Copy Markdown
Member

Why don't we move this:

node/lib/_http_outgoing.js

Lines 136 to 140 in 6192c98

if (data.length === 0) {
if (typeof callback === 'function')
process.nextTick(callback);
return true;
}
into the first if clause after it? So that callback won't be invoked immediately for the empty write if there is no assigned connection.

Should be way simpler than the current version of PR.

Also, please run make test to ensure that it works, and this change requires a test case as well.

Thanks for figuring it out!

@indutny

indutny commented Sep 25, 2015

Copy link
Copy Markdown
Member

I have a question, though... Does it really change anything when applied with #3059 ?

@indutny

indutny commented Sep 25, 2015

Copy link
Copy Markdown
Member

One more comment: I think if you'll make it work as I suggested in first comment - it looks like there should not be any need in #3059 anymore, as the finish event will be guaranteed to fire after prefinish. Do you think this is a correct statement?

@indutny

indutny commented Sep 25, 2015

Copy link
Copy Markdown
Member

cc @trevnorris @nodejs/collaborators

@mareksrom

Copy link
Copy Markdown
Author

You are right #3059 is solved by this. If suggested block is moved into first if after it, it will continue in last else and crash on trying to buffer empty data... we need to return true in this case but not invoke callback... is it right?

@indutny

indutny commented Sep 25, 2015

Copy link
Copy Markdown
Member

@mareksrom why will it crash? It doesn't look like it will do it. Returning true does not make sense to me, we are not going to send anything anyway.

@indutny

indutny commented Sep 25, 2015

Copy link
Copy Markdown
Member

@mareksrom one more question: why is it better than #3059 ? What else is it doing? I like the minimalistic nature of this PR, but just want to see if it fixes more issues than #3059. So far it looks like it isn't.

@mareksrom

Copy link
Copy Markdown
Author

I'm not sure, but I had it this way and maybe it crashed on writing nothing to connection or I don't know, I can try it again, maybe it was another problem... I'm going to try it...

@mareksrom

Copy link
Copy Markdown
Author

#3059 does not work... it only calls prefinish before finish, but what does prefinish? problem is that prefinish and finish should be called after socket was assigned and data were flushed, #3059 calls prefinish with finish callback in time it does not have even connection assigned...

@mareksrom

Copy link
Copy Markdown
Author

@indutny your proposal to move empty data to first if is ok... let's do it this way...

@trevnorris

Copy link
Copy Markdown
Contributor

There are style issues, but I like the approach.

@indutny

indutny commented Sep 26, 2015

Copy link
Copy Markdown
Member

@mareksrom any news? ;)

Comment thread lib/_http_outgoing.js

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connection is already asserted above.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a better fix, feel free to skip this PR.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a better fix, feel free to skip this PR.

Are you going to open another PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arthurschreiber of course!

@mareksrom

Copy link
Copy Markdown
Author

@indurny what news? modification you proposed works and it can be this way, question is if there has to be all the block with check for data.length===0, without it it will also work, just less effective (useless empty write) that will also happen if we change it according to your proposal...

@indutny

indutny commented Sep 26, 2015

Copy link
Copy Markdown
Member

@mareksrom I think I have it working locally. Btw, is the email on your profile correct?

@mareksrom

Copy link
Copy Markdown
Author

@indutny ...

@indutny

indutny commented Sep 26, 2015

Copy link
Copy Markdown
Member

@mareksrom I mean github profile.

@indutny

indutny commented Sep 26, 2015

Copy link
Copy Markdown
Member

@mareksrom argh, I meant the one that you are using for commits: https://github.com/mareksrom/node/commit/192b28bf2fc688f3da9ad0caa0ecbb84efaf3330.patch

@indutny

indutny commented Sep 26, 2015

Copy link
Copy Markdown
Member

@mareksrom anyway, may I ask you to contact me by email? It is available on my github's profile page: https://github.com/indutny

@mareksrom

Copy link
Copy Markdown
Author

yes it is...

@Fishrock123

Copy link
Copy Markdown
Contributor

This isn't related to 11e4249, right?

@arthurschreiber

Copy link
Copy Markdown

@Fishrock123 It is.

@arthurschreiber

Copy link
Copy Markdown

@indutny Any news on this issue?

@vandernorth

Copy link
Copy Markdown

Will this be merged or are we still awaiting changes?

@rvagg

rvagg commented Sep 30, 2015

Copy link
Copy Markdown
Member

we'll make sure the fix gets in to 4.1.2 but that's slated for Monday so we have time to resolve outstanding concerns that this has been properly solved

@arthurschreiber

Copy link
Copy Markdown

Thanks for the update, @rvagg!

@Fishrock123

Copy link
Copy Markdown
Contributor

Fedor's modified fix(es) landed in 342c3a1...a4fa51c and released as 4.1.2, see: https://nodejs.org/en/

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

Labels

http Issues or PRs related to the http subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants