-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
requestTimeout and long running uploads #46574
Comments
Try this.
|
@theanarkh Why? What do you expect to see with this? From what I understand, there is still an issue in how |
Fixes https://xcp-ng.org/forum/post/58146 Caused by nodejs/node#46574 It caused requests to timeout after 0-30 seconds, which broke all uploads.
@ShogunPanda Any opinions on this? |
Inside the connection handling algorithm I always use @nodejs/libuv Do you think this might explain it? |
@ShogunPanda explain what exactly? |
@bnoordhuis I re-read it and got it wrong probably. I'll try to reproduce and see what happens. I'll get back here shortly. |
I have been experiencing the same issue. I set a I noticed though after 2 hours of uptime on the system it started to work correctly. After this I set the So I opted to set the |
Unfortunately I cannot reproduce this. I tried both on a Mac and on Linux. |
I don't see anything related to the uptime of my machine. @ShogunPanda What behavior do you get with my test script above? On my system (and others like Ubuntu), |
@julien-f In my case the server keeps receiving the request without issues. |
So I altered the @julien-f script to work more closely with how we have encountered it. Node Version: 18.12.1 const http = require('node:http');
const srv = http.createServer((req, res) => {
console.log(req.method, req.url);
req.resume().on('end', () => {
res.end('Ok');
}).on('error', console.warn);
}
).listen(10080);
srv.requestTimeout = 10 * 60 * 1000; // 10 minute timeout I get the following output before 10 minutes uptime: $ uptime
07:44:46 up 5 min, 0 users, load average: 29.40, 19.92, 8.74
$ curl -T /dev/urandom http://localhost:10080 | cat
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 211M 0 0 0 211M 0 20.0M --:--:-- 0:00:10 --:--:-- 20.6M
curl: (55) Send failure: Broken pipe
$ curl -T /dev/urandom http://localhost:10080 | cat
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 256M 0 0 0 256M 0 20.8M --:--:-- 0:00:12 --:--:-- 21.3M
curl: (55) Send failure: Broken pipe After 10 minutes of uptime it looks like this: $ uptime
07:56:26 up 16 min, 0 users, load average: 2.90, 6.76, 8.16
$ curl -T /dev/urandom http://localhost:10080 | cat
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.3G 0 0 0 13.3G 0 21.9M --:--:-- 0:10:25 --:--:-- 22.3M
curl: (55) Send failure: Broken pipe
$ curl -T /dev/urandom http://localhost:10080 | cat
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12.8G 0 0 0 12.8G 0 21.9M --:--:-- 0:10:01 --:--:-- 21.2M
curl: (55) Send failure: Broken pipe I'm not sure if I'm missing anything or if setting the |
Fixes https://xcp-ng.org/forum/post/58146 Caused by nodejs/node#46574 It caused requests to timeout after 0-30 seconds, which broke all uploads.
Running into this as well it seems. Its an ARMv7 architecture. So far I have only manually reproduced it by uploading a 230 MB file, takes about 10 seconds to complete, handled by express and multer (certainly not a minimal reproduction setup). The timeout can happen anywhere within the transfer. This only seems to happen when the uptime of the system is between 2 and 5 minutes. Running node |
Getting this issue as well, there seem to be some upper limit to requestTimeout when it stops working and any connections gets timed out whenever connectionsCheckingInterval fires. EDIT: Can't say for sure what's causing this, or under what circumstances, but requestTimeout is definitely bugged. |
Hello, We are seeing a lot of unexpected status 408 responses as well. Most notably in our CI environment running Node.js 18.17.1 in Google Cloud Build on n1-highcpu-32 VMs (x86_64). We see 408s for pretty much all requests, even very simple GET requests. The test HTTP servers use default options/timeouts. Our busiest test pipeline saw at least one unexpected 408 request timeout in about 50% of the builds. We traced this down to a bug in the logic behind node/deps/uv/docs/src/misc.rst Lines 563 to 572 in c9c958e
By definition, uv_hrtime() readings may be less than the configured request or header timeouts. In turn, the subtractions may overflow and flag all connections as stale. I'll add a few example readings below.
The default request timeout is
The overflow bug has been fixed on the Also, WDYT about updating the comment in the above patch to explain that this affects ALL environments, not just IoT/embedded devices? Something like this |
The #48291 fix will set the timeout to infinite if the hrtime is too low? If a shorter timeout is requested is that not unexpected? |
You can see |
Version
v18.14.0
Platform
Linux prometheus 6.1.9-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Feb 2 00:21:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
http
What steps will reproduce the bug?
Create an HTTP server with a big
requestTimeout
(a day in this example):Do a long running request to it:
How often does it reproduce? Is there a required condition?
It happens everytime, and I haven't been able to pinpoint the exact value at which it becomes problematic.
What is the expected behavior?
It should interrupt the request after 24 hours.
What do you see instead?
It interrupt the request after ~30 seconds.
Additional information
I can work-around by disabling the timeout (
requestTimeout: 0
) completely but setting a value, even high, seemed preferable.Any other suggestions on how to handle long running uploads?
The text was updated successfully, but these errors were encountered: