GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http: unref socket timer on parser execute by indutny · Pull Request #6286 · nodejs/node

Conversation

@indutny

@indutny 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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@indutny
http: unref socket timer on parser execute
602c6ae
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 indutny mentioned this pull request Apr 19, 2016
Socket setTimeout behaviour not working as expected for HTTP requests #5899
Closed
@indutny

indutny commented Apr 19, 2016

Copy link
Copy Markdown
Member Author

CI: https://ci.nodejs.org/job/node-test-pull-request/2325/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny indutny added the http Issues and PRs related to the http subsystem. label Apr 19, 2016
@mtharrison mtharrison mentioned this pull request Apr 19, 2016
Socket disconnects when payload timeout is false hapijs/hapi#3099
Closed
@indutny
test: increase timeout for slow CI servers
fb4faae
@indutny

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/

defstream reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexjeffburke

alexjeffburke commented Apr 20, 2016

Copy link
Copy Markdown
Contributor

Quick question, does this apply to v4 as well?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Apr 20, 2016

Copy link
Copy Markdown
Member Author

It does.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny indutny added the lts-watch-v4.x label Apr 20, 2016
@indutny

indutny commented Apr 20, 2016

Copy link
Copy Markdown
Member Author

Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Apr 20, 2016

Copy link
Copy Markdown
Member Author

cc @nodejs/http @bnoordhuis @trevnorris @jasnell

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell reviewed Apr 20, 2016
View reviewed changes
Comment thread test/parallel/test-http-server-consumed-timeout.js Outdated
assert(false, 'Should not happen');
});
req.resume();
req.once('end', () => {

@jasnell jasnell Apr 20, 2016

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nit: wrap this in common.mustCall() ?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@indutny indutny Apr 20, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ack.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jasnell

jasnell commented Apr 20, 2016

Copy link
Copy Markdown
Member

LGTM with a couple nits in the test.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexjeffburke

alexjeffburke commented Apr 20, 2016

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mscdex
mscdex reviewed Apr 20, 2016
View reviewed changes
Comment thread test/parallel/test-http-server-consumed-timeout.js Outdated
setTimeout(() => {
clearInterval(interval);
req.end();
}, 400);

@mscdex mscdex Apr 20, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@indutny indutny Apr 20, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ack.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@indutny
fix
0f9c634
@indutny

indutny commented Apr 20, 2016

Copy link
Copy Markdown
Member Author

All fixed, new CI: https://ci.nodejs.org/job/node-test-pull-request/2345/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Apr 20, 2016

Copy link
Copy Markdown
Member Author

Landed in ec2822a, thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny indutny closed this Apr 20, 2016
indutny added a commit that referenced this pull request Apr 20, 2016
@indutny
http: unref socket timer on parser execute
ec2822a
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 <[email protected]>
@vixlet-kevin

vixlet-kevin commented Apr 20, 2016

Copy link
Copy Markdown

Thanks for the fix!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
@indutny Myles Borins
http: unref socket timer on parser execute
a259ee4
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 <[email protected]>
This was referenced Apr 21, 2016
V5.11.0 proposal #6321
Closed
V5.11.0 proposal #6322
Closed
MylesBorins pushed a commit that referenced this pull request Apr 21, 2016
@indutny @MylesBorins
http: unref socket timer on parser execute
8ccfb87
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 <[email protected]>
@mhdawson mhdawson mentioned this pull request Apr 25, 2016
test: increase the platform timeout for AIX #6342
Closed
2 tasks done
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request Apr 25, 2016
@indutny @joelostrowski
http: unref socket timer on parser execute
7239013
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 <[email protected]>
jasnell pushed a commit that referenced this pull request Apr 26, 2016
@indutny @jasnell
http: unref socket timer on parser execute
816df10
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 <[email protected]>
MylesBorins pushed a commit that referenced this pull request May 17, 2016
@indutny Myles Borins
http: unref socket timer on parser execute
1b3b435
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 <[email protected]>
@MylesBorins MylesBorins added land-on-v4.x and removed lts-watch-v4.x labels May 17, 2016
MylesBorins pushed a commit that referenced this pull request May 18, 2016
@indutny Myles Borins
http: unref socket timer on parser execute
9a8b531
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 <[email protected]>
@MylesBorins MylesBorins mentioned this pull request May 18, 2016
v4.4.5 proposal #6824
Merged
@Trott

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jul 13, 2016

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott Trott mentioned this pull request Jul 13, 2016
test: fix flaky test-http-server-consumed-timeout #7717
Closed
3 tasks done
@underflow00 underflow00 mentioned this pull request Feb 18, 2020
Timeout to prevent slow sending attack expressjs/body-parser#389
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

http Issues and PRs related to the http subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Socket setTimeout behaviour not working as expected for HTTP requests

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@indutny @alexjeffburke @jasnell @vixlet-kevin @Trott @mscdex @MylesBorins
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.