FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

http: unref socket timer on parser execute by indutny · Pull Request #6286 · nodejs/node · GitHub

/ node Public

http: unref socket timer on parser execute - #6286

Closed
indutny wants to merge 3 commits into
nodejs:masterfrom
indutny:fix/gh-5899
Closed

http: unref socket timer on parser execute#6286
indutny wants to merge 3 commits into
nodejs:masterfrom
indutny:fix/gh-5899

Conversation

indutny commented Apr 19, 2016

Copy link
Copy Markdown
Member
Checklist
  • tests and code linting passes
  • a test and/or benchmark is included
  • the commit message follows commit guidelines
Affected core subsystem(s)

http

Description of change

When underlying net.Socket instance is consumed in http server - no
data events are emitted, and thus socket.setTimeout fires the
callback even if the data is constantly flowing into the socket.

Fix this by calling socket._unrefTimer() on every onParserExecute
call.

Fix: #5899

When underlying `net.Socket` instance is consumed in http server - no
`data` events are emitted, and thus `socket.setTimeout` fires the
callback even if the data is constantly flowing into the socket.

Fix this by calling `socket._unrefTimer()` on every `onParserExecute`
call.

Fix: nodejs#5899

indutny commented Apr 19, 2016

Copy link
Copy Markdown
Member Author

indutny added the http Issues or PRs related to the http subsystem. label Apr 19, 2016

indutny commented Apr 19, 2016

Copy link
Copy Markdown
Member Author

Gosh, timing issues on FreeBSD CI slave. One more try after the fix: https://ci.nodejs.org/job/node-test-pull-request/2327/

Copy link
Copy Markdown
Contributor

Quick question, does this apply to v4 as well?

indutny commented Apr 20, 2016

Copy link
Copy Markdown
Member Author

It does.

indutny commented Apr 20, 2016

Copy link
Copy Markdown
Member Author

Thank you!

indutny commented Apr 20, 2016

Copy link
Copy Markdown
Member Author

cc @nodejs/http @bnoordhuis @trevnorris @jasnell

assert(false, 'Should not happen');
});
req.resume();
req.once('end', () => {

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nit: wrap this in common.mustCall() ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ack.

jasnell commented Apr 20, 2016

Copy link
Copy Markdown
Member

LGTM with a couple nits in the test.

Copy link
Copy Markdown
Contributor

@indutny glad if I've helped & thank you for the fix :)

setTimeout(() => {
clearInterval(interval);
req.end();
}, 400);

mscdex Apr 20, 2016
edited
Loading

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This timeout value should probably be wrapped with common.platformTimeout()?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ack.

indutny commented Apr 20, 2016

Copy link
Copy Markdown
Member Author

indutny commented Apr 20, 2016

Copy link
Copy Markdown
Member Author

Landed in ec2822a, thank you!

indutny closed this Apr 20, 2016
indutny added a commit that referenced this pull request Apr 20, 2016
When underlying `net.Socket` instance is consumed in http server - no
`data` events are emitted, and thus `socket.setTimeout` fires the
callback even if the data is constantly flowing into the socket.

Fix this by calling `socket._unrefTimer()` on every `onParserExecute`
call.

Fix: #5899
PR-URL: #6286
Reviewed-By: James M Snell <jasnell@gmail.com>

Copy link
Copy Markdown

Thanks for the fix!

MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
When underlying `net.Socket` instance is consumed in http server - no
`data` events are emitted, and thus `socket.setTimeout` fires the
callback even if the data is constantly flowing into the socket.

Fix this by calling `socket._unrefTimer()` on every `onParserExecute`
call.

Fix: #5899
PR-URL: #6286
Reviewed-By: James M Snell <jasnell@gmail.com>
This was referenced Apr 21, 2016
MylesBorins pushed a commit that referenced this pull request Apr 21, 2016
When underlying `net.Socket` instance is consumed in http server - no
`data` events are emitted, and thus `socket.setTimeout` fires the
callback even if the data is constantly flowing into the socket.

Fix this by calling `socket._unrefTimer()` on every `onParserExecute`
call.

Fix: #5899
PR-URL: #6286
Reviewed-By: James M Snell <jasnell@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request Apr 25, 2016
When underlying `net.Socket` instance is consumed in http server - no
`data` events are emitted, and thus `socket.setTimeout` fires the
callback even if the data is constantly flowing into the socket.

Fix this by calling `socket._unrefTimer()` on every `onParserExecute`
call.

Fix: nodejs#5899
PR-URL: nodejs#6286
Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 26, 2016
When underlying `net.Socket` instance is consumed in http server - no
`data` events are emitted, and thus `socket.setTimeout` fires the
callback even if the data is constantly flowing into the socket.

Fix this by calling `socket._unrefTimer()` on every `onParserExecute`
call.

Fix: #5899
PR-URL: #6286
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 17, 2016
When underlying `net.Socket` instance is consumed in http server - no
`data` events are emitted, and thus `socket.setTimeout` fires the
callback even if the data is constantly flowing into the socket.

Fix this by calling `socket._unrefTimer()` on every `onParserExecute`
call.

Fix: #5899
PR-URL: #6286
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 18, 2016
When underlying `net.Socket` instance is consumed in http server - no
`data` events are emitted, and thus `socket.setTimeout` fires the
callback even if the data is constantly flowing into the socket.

Fix this by calling `socket._unrefTimer()` on every `onParserExecute`
call.

Fix: #5899
PR-URL: #6286
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins mentioned this pull request May 18, 2016

Trott commented Jul 13, 2016

Copy link
Copy Markdown
Member

Looks like FreeBSD timing issues are back with this: #7643

I guess if there was some way to make this not dependent on a timer race, that would have happened, yeah? :-/

@nodejs/testing

Trott commented Jul 13, 2016

Copy link
Copy Markdown
Member

Actually, I think I've fixed it. PR coming soon...

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Socket setTimeout behaviour not working as expected for HTTP requests

7 participants


Back | FazBrowse Home | New Git URL