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: fix for handling on boot timers headers and request by franciszek-koltuniuk-red · Pull Request #48291 · nodejs/node

Conversation

@franciszek-koltuniuk-red

@franciszek-koltuniuk-red franciszek-koltuniuk-red commented Jun 2, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

This change is a fix for handling headersTimeout and requestTimeout
that causes unexpected behavior if the HTTP server is started on boot:

  • the connections to the server can be closed immediately
    with the status HTTP 408

This issue usually happens in IoT or embedded devices where
the reference timestamp (returned by uv_hrtime()) is counted since boot
and can be smaller than the headersTimeout or the requestTimeout value.

Additionally added performance improvement to process the list of
connection only if one of the timers should be processed

Sorry, something went wrong.

Uh oh!

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

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@nodejs-github-bot

nodejs-github-bot commented Jun 2, 2023

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net
All reactions

Sorry, something went wrong.

Uh oh!

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

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. http_parser Issues and PRs related to the HTTP parser implementation or http_parser binding. needs-ci PRs that need a full CI run. labels Jun 2, 2023
@ShogunPanda

ShogunPanda commented Jun 2, 2023

Copy link
Copy Markdown
Contributor

In general LGTM. Can you please add a test?

All reactions

Sorry, something went wrong.

Uh oh!

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

@franciszek-koltuniuk-red

franciszek-koltuniuk-red commented Jun 2, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

I try to prepare a test case for this, but the issue is observed when the now is less than headersTimeout or requestTimeout where now is :
const uint64_t now = uv_hrtime();
I don't know how to create test like test/parallel/test-http-server-request-timeout-interrupted-body.js to fulfill this requirement in all environments
The value for headersTimeout or requestTimeout is limited to Integer see validation requestTimeout and headersTimeout

All reactions

Sorry, something went wrong.

Uh oh!

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

@franciszek-koltuniuk-red

franciszek-koltuniuk-red commented Jun 2, 2023

Copy link
Copy Markdown
Contributor Author

This issue is observed since "refactor headersTimeout and requestTimeout logic" #41263

All reactions

Sorry, something went wrong.

Uh oh!

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

ronag
ronag approved these changes Jun 2, 2023
View reviewed changes
@ShogunPanda

ShogunPanda commented Jun 2, 2023

Copy link
Copy Markdown
Contributor

I don't know how to create test like test/parallel/test-http-server-request-timeout-interrupted-body.js to fulfill this requirement in all environments

@nodejs/libuv Do you have any opinion on this? Is there a way to mock uv_hrtime?

All reactions

Sorry, something went wrong.

Uh oh!

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

@bnoordhuis

bnoordhuis commented Jun 2, 2023

Copy link
Copy Markdown
Member

Is there a way to mock uv_hrtime?

In libuv? No.1 You can of course refactor node's code to make hrtime calls pluggable but that's overkill for a simple fix like this.

1 Or rather, you can overload clock_gettime/mach_absolute_time/mach_continuous_time/etc. through LD_PRELOAD/DYLD_PRELOAD but that's probably not what you mean.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ShogunPanda

ShogunPanda commented Jun 2, 2023

Copy link
Copy Markdown
Contributor

Yeah, definitely too much for a simple verification.
The next run on the connectionsCheckingInterval would kill connections anyway.

Are we good in landing this without a test?

All reactions

Sorry, something went wrong.

Uh oh!

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

benjamingr
benjamingr approved these changes Jun 3, 2023
View reviewed changes

@benjamingr benjamingr left a comment

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.

If we can't test this - it would be good to at least add a comment to why this change is being made in the code.

Sorry, something went wrong.

Uh oh!

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

All reactions
jasnell
jasnell approved these changes Jun 3, 2023
View reviewed changes

@jasnell jasnell left a comment

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.

LGTM but I agree that additional comments would be helpful.

Sorry, something went wrong.

Uh oh!

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

All reactions
@franciszek-koltuniuk-red franciszek-koltuniuk-red changed the title Headers request timers fix http: fix for handling on boot timers headers and request Jun 4, 2023
@franciszek-koltuniuk-red

franciszek-koltuniuk-red commented Jun 5, 2023

Copy link
Copy Markdown
Contributor Author

additional comments would be helpful.

Code commented

All reactions

Sorry, something went wrong.

Uh oh!

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

ShogunPanda
ShogunPanda approved these changes Jun 5, 2023
View reviewed changes
marco-ippolito
marco-ippolito approved these changes Jun 5, 2023
View reviewed changes
@franciszek-koltuniuk-red
franciszek-koltuniuk-red force-pushed the headers-request-timers-fix branch from 590d23f to ae3f8ca Compare June 7, 2023 14:24
franciszek-koltuniuk-red added 3 commits June 7, 2023 16:28
@franciszek-koltuniuk-red
http: fix for handling on boot timers headers and request
5bc194c
This change is a fix for handling headersTimeout and requestTimeout
that causes unexpected behavior if the HTTP server is started on boot:

 - the connections to the server can be closed immediately
   with the status HTTP 408

This issue usually happens on IoT or embedded devices where
the reference timestamp (returned by uv_hrtime()) is counted since boot
and can be smaller than the headersTimeout or the requestTimeout value.

Additionally added performance improvement to process the list of
connection only if one of the timers should be processed
@franciszek-koltuniuk-red
update after autochecks
cd272a6
@franciszek-koltuniuk-red
update in sourcode: commented the change
fc3c854
@franciszek-koltuniuk-red
franciszek-koltuniuk-red force-pushed the headers-request-timers-fix branch from ae3f8ca to fc3c854 Compare June 7, 2023 14:30
@franciszek-koltuniuk-red

franciszek-koltuniuk-red commented Jun 7, 2023

Copy link
Copy Markdown
Contributor Author

I had to re-edit commits messages, to fulfill the commit message check

All reactions

Sorry, something went wrong.

Uh oh!

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

@marco-ippolito marco-ippolito added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jun 8, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jun 8, 2023
@nodejs-github-bot

nodejs-github-bot commented Jun 8, 2023

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

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

mcollina
mcollina approved these changes Jun 8, 2023
View reviewed changes

@mcollina mcollina left a comment

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.

lgtm

Sorry, something went wrong.

Uh oh!

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

All reactions
This was referenced Jun 9, 2023
CI Reliability 2023-06-09 nodejs/reliability#588
Open
CI Reliability 2023-06-10 nodejs/reliability#589
Open
@franciszek-koltuniuk-red

franciszek-koltuniuk-red commented Jun 13, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

I see that checks failed but these fails are not related to this change:

  • node-test-commit — tests failed due to dependency on node-test-commit-osx, node-test-commit-windows-fanned, node-test-binary-windows-js-suites
  • node-test-commit-osx — tests failed due to:
    10:45:24 Failed to write /Users/iojs/build/workspace/node-test-commit-osx/nodes/osx1015/out/Release/obj/gen/node_snapshot.cc 10:45:24 make[2]: *** [/Users/iojs/build/workspace/node-test-commit-osx/nodes/osx1015/out/Release/obj/gen/node_snapshot.cc] Error 1
    see: Failed to write /Users/iojs/build/workspace/node-test-commit-osx/nodes/osx1015/out/Release/obj/gen/node_snapshot.cc
  • node-test-commit-windows-fanned — tests failed due to dependency on node-test-binary-windows-js-suites
  • node-test-pull-reques — tests failed due to dependency on node-test-commit
  • node-test-binary-windows-js-suites — tests failed due to:
    10:28:19 Can't clean tmpdir: C:\workspace\node-test-binary-windows-js-suites\node\test\.tmp.168 10:28:19 Files blocking: [ 'node.heapsnapshot' ] 10:28:19 10:28:19 C:\workspace\node-test-binary-windows-js-suites\node\test\common\tmpdir.js:68 10:28:19 throw e; 10:28:19 ^ 10:28:19 10:28:19 Error: EBUSY: resource busy or locked, rmdir '\\?\C:\workspace\node-test-binary-windows-js-suites\node\test\.tmp.168'
    see: Can't clean tmpdir: C:\workspace\node-test-binary-windows-js-suites\node\test.tmp.168

to summarize the test failed due to errors unrelated to this change.

What can I do to process this pull request?

btw.
I think that it would be desirable to backport this change to stable branches

All reactions

Sorry, something went wrong.

Uh oh!

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

@nodejs-github-bot

nodejs-github-bot commented Jun 14, 2023

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@nodejs-github-bot

nodejs-github-bot commented Jun 14, 2023

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot mentioned this pull request Jun 15, 2023
CI Reliability 2023-06-15 nodejs/reliability#594
Open
22 tasks
@franciszek-koltuniuk-red

franciszek-koltuniuk-red commented Jun 19, 2023

Copy link
Copy Markdown
Contributor Author

What is blocking this change from being merged?

All reactions

Sorry, something went wrong.

Uh oh!

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

@tniessen tniessen added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-squash PRs the Commit Queue should land as one squashed commit. labels Jun 19, 2023
@ShogunPanda ShogunPanda added the commit-queue PRs queued for automated landing through the Commit Queue. label Jun 19, 2023
@ShogunPanda

ShogunPanda commented Jun 19, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

I tried to add the labels to merge this. But since CI is locked for upcoming security releases I'm not sure if this will affected as well.

I was completely wrong. Nevermind. Landed :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Jun 19, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 8e710c9 into nodejs:main Jun 19, 2023
@nodejs-github-bot

nodejs-github-bot commented Jun 19, 2023

Copy link
Copy Markdown
Collaborator

Landed in 8e710c9

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot mentioned this pull request Jun 21, 2023
CI Reliability 2023-06-21 nodejs/reliability#595
Open
29 tasks
RafaelGSS pushed a commit that referenced this pull request Jul 3, 2023
@franciszek-koltuniuk-red @RafaelGSS
http: fix for handling on boot timers headers and request
2f0f403
This change is a fix for handling headersTimeout and requestTimeout
that causes unexpected behavior if the HTTP server is started on boot:

 - the connections to the server can be closed immediately
   with the status HTTP 408

This issue usually happens on IoT or embedded devices where
the reference timestamp (returned by uv_hrtime()) is counted since boot
and can be smaller than the headersTimeout or the requestTimeout value.

Additionally added performance improvement to process the list of
connection only if one of the timers should be processed

PR-URL: #48291
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Jul 3, 2023
v20.4.0 proposal #48643
Merged
@franciszek-koltuniuk-red

franciszek-koltuniuk-red commented Jul 13, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

@RafaelGSS who can decide to backport this fix to LTS branches?

All reactions

Sorry, something went wrong.

Uh oh!

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

Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@franciszek-koltuniuk-red @Ceres6
http: fix for handling on boot timers headers and request
81a4df8
This change is a fix for handling headersTimeout and requestTimeout
that causes unexpected behavior if the HTTP server is started on boot:

 - the connections to the server can be closed immediately
   with the status HTTP 408

This issue usually happens on IoT or embedded devices where
the reference timestamp (returned by uv_hrtime()) is counted since boot
and can be smaller than the headersTimeout or the requestTimeout value.

Additionally added performance improvement to process the list of
connection only if one of the timers should be processed

PR-URL: nodejs#48291
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@franciszek-koltuniuk-red @Ceres6
http: fix for handling on boot timers headers and request
1dab37d
This change is a fix for handling headersTimeout and requestTimeout
that causes unexpected behavior if the HTTP server is started on boot:

 - the connections to the server can be closed immediately
   with the status HTTP 408

This issue usually happens on IoT or embedded devices where
the reference timestamp (returned by uv_hrtime()) is counted since boot
and can be smaller than the headersTimeout or the requestTimeout value.

Additionally added performance improvement to process the list of
connection only if one of the timers should be processed

PR-URL: nodejs#48291
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@das7pad das7pad mentioned this pull request Aug 31, 2023
requestTimeout and long running uploads #46574
Closed
ruyadorno pushed a commit that referenced this pull request Sep 10, 2023
@franciszek-koltuniuk-red @ruyadorno
http: fix for handling on boot timers headers and request
68052fb
This change is a fix for handling headersTimeout and requestTimeout
that causes unexpected behavior if the HTTP server is started on boot:

 - the connections to the server can be closed immediately
   with the status HTTP 408

This issue usually happens on IoT or embedded devices where
the reference timestamp (returned by uv_hrtime()) is counted since boot
and can be smaller than the headersTimeout or the requestTimeout value.

Additionally added performance improvement to process the list of
connection only if one of the timers should be processed

PR-URL: #48291
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@ruyadorno ruyadorno mentioned this pull request Sep 10, 2023
v18.18.0 proposal #49220
Merged
ruyadorno pushed a commit that referenced this pull request Sep 13, 2023
@franciszek-koltuniuk-red @ruyadorno
http: fix for handling on boot timers headers and request
977e9a3
This change is a fix for handling headersTimeout and requestTimeout
that causes unexpected behavior if the HTTP server is started on boot:

 - the connections to the server can be closed immediately
   with the status HTTP 408

This issue usually happens on IoT or embedded devices where
the reference timestamp (returned by uv_hrtime()) is counted since boot
and can be smaller than the headersTimeout or the requestTimeout value.

Additionally added performance improvement to process the list of
connection only if one of the timers should be processed

PR-URL: #48291
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@coderabbitai coderabbitai Bot mentioned this pull request Jul 26, 2026
Make Render health checks immediate and deterministic AlexAyvazian/Map#19
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@ShogunPanda ShogunPanda ShogunPanda approved these changes
@jasnell jasnell jasnell approved these changes
@benjamingr benjamingr benjamingr approved these changes
@ronag ronag ronag approved these changes
@marco-ippolito marco-ippolito marco-ippolito approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash PRs the Commit Queue should land as one squashed commit. http_parser Issues and PRs related to the HTTP parser implementation or http_parser binding. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

10 participants

@franciszek-koltuniuk-red @nodejs-github-bot @ShogunPanda @bnoordhuis @mcollina @jasnell @benjamingr @ronag @marco-ippolito @tniessen
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.