Skip to content

httpServer.requestTimeout aborts downloads after 100 seconds #41934

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

Open
lb99bl opened this issue Feb 11, 2022 · 2 comments
Open

httpServer.requestTimeout aborts downloads after 100 seconds #41934

lb99bl opened this issue Feb 11, 2022 · 2 comments
Labels
http Issues or PRs related to the http subsystem.

Comments

@lb99bl
Copy link

lb99bl commented Feb 11, 2022

Version

v16.14.0

Platform

Linux ___ 5.4.0-99-generic #112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

If I comment out the requestTimeout (the second line), then I can download the large file that takes minutes (I simulate with Chromium's network throttle to 'Slow 3G').

If I have the requestTimeout enabled, then node.js aborts the download after (usually) 100 seconds (typically after 4 MB on 'Slow 3G').

const httpServer = require("http").createServer().listen(8080)
httpServer.requestTimeout = 16000
httpServer.on('request',function(client_req,client_res) {
	var file = require('fs').createReadStream('large.zip')
	file.on('open',function(){
		client_res.writeHead(200,{"Content-Type":"application/zip"})
		file.pipe(client_res)
	})
})

Also tested on a different browser with real slow connection.

How often does it reproduce? Is there a required condition?

Always without exception.

What is the expected behavior?

If I set httpServer.requestTimeout, it does not abort the download at all.

What do you see instead?

Download is aborted after (usually) 100 seconds.

Additional information

No response

@benjamingr
Copy link
Member

requestTimeout -

Sets the timeout value in milliseconds for receiving the entire request from the client.

Do you perhaps want to set the socket timeout (req.setTimeout) instead if what you want to check is inactivity on the connection rather the total request timeout?

@Mesteery Mesteery added the http Issues or PRs related to the http subsystem. label Feb 11, 2022
@theanarkh
Copy link
Contributor

theanarkh commented Jul 26, 2022

It seems it had been fixed in main branch.

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

No branches or pull requests

4 participants