-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
http - calls from an external IP close after 5-20 seconds using response.end and Content-Length header is set (Node 8.X) #14869
Comments
I'm afraid I can't reproduce and honestly, I can't think of anything in node that would cause that. I think a more likely explanation is that there is something on your local system or network that causes the issue. |
@bnoordhuis If it helps, instead of using Linux Mint 18 as the node server, I've tried hosting on a Mac OSX Sierra (10.12.6) from a completely different network and it's happening here as well. The differences here being, size of words file and it seemingly takes much longer than 15 seconds, instead taking about 50-70 seconds. I'm not sure if the connection closing at the same byte every time is somewhat suspect. Node 8.4.0 (obfuscated my IPs) --2017-08-18 07:34:26-- http://8.8.8.9:3000/send
Connecting to 8.8.8.9:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2493109 (2.4M)
Saving to: ‘send’ --- 148.37K 3.00KB/s in 60s
2017-08-18 07:35:27 (2.48 KB/s) - Connection closed at byte 151935. Retrying.
--2017-08-18 07:35:28-- (try: 2) http://8.8.8.9:3000/send
Connecting to 8.8.8.9:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2493109 (2.4M)
Saving to: ‘send’ --- 147.69K 2.49KB/s in 67s
2017-08-18 07:36:36 (2.19 KB/s) - Connection closed at byte 151935. Retrying.
--2017-08-18 07:36:38-- (try: 3) http://8.8.8.9:3000/send
Connecting to 8.8.8.9:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2493109 (2.4M)
Saving to: ‘send’ --- 145.55K 2.51KB/s in 55s
2017-08-18 07:37:34 (2.63 KB/s) - Connection closed at byte 151935. Retrying.
--2017-08-18 07:37:37-- (try: 4) http://8.8.8.9:3000/send
Connecting to 8.8.8.9:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2493109 (2.4M)
Saving to: ‘send’ --- 5.55K 3.00KB/s |
I tried it on a different box with, going by the file size, probably the same words file as you (Ubuntu 16.04) and it still works. It takes about three minutes to download the file but it doesn't error, Content-Length header or not, local or external interface. |
I also tried the MacOSX with Node 7.10.1 and it seems to work correctly. It does eventually timeout according to the server timeout, but it seems to be at almost 11 minutes rather than 10 which is weird... > wget 8.8.8.9:3000/send --limit-rate=3k
--2017-08-18 07:55:54-- http://8.8.8.9:3000/send
Connecting to 8.8.8.9:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2493109 (2.4M)
Saving to: ‘send’ --- 1.42M 1.92KB/s in 10m 56s
2017-08-18 08:06:59 (2.21 KB/s) - Connection closed at byte 1486335. Retrying.
--2017-08-18 08:07:00-- (try: 2) http://8.8.8.9:3000/send
Connecting to 8.8.8.9:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2493109 (2.4M)
Saving to: ‘send’ --- 72.02K 2.52KB/s eta 18m 50s |
Also to add, I tried hosting on a bare bones AWS EC2 - Centos 6 (Linux 2.6.32-573.3.1.el6.x86_64 SMP Thu Aug 13 22:55:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux) machine. I had to ship a different file, but it still experiences the same symptoms as before. Previously, I had been using NVM to handle installations of Node, but this time I tried just the Linux x64 binaries. With v8.4.0, sure enough, it fails the request after about 15 seconds when Content-Length is set. > wget http://8.8.8.8:3000/send --limit-rate=3k
--2017-08-18 09:23:07-- http://8.8.8.8:3000/send
Resolving 8.8.8.8 (8.8.8.8)... 8.8.8.8
Connecting to 8.8.8.8 (8.8.8.8)|8.8.8.8|:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19189239 (18M)
Saving to: ‘send.1’ --- 42.32K 3.00KB/s in 14s
2017-08-18 09:23:21 (3.00 KB/s) - Connection closed at byte 43334. Retrying.
--2017-08-18 09:23:22-- (try: 2) http://8.8.8.8:3000/send
Connecting to 8.8.8.8 (8.8.8.8)|8.8.8.8|:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19189239 (18M)
Saving to: ‘send.1’ --- 42.32K 3.00KB/s in 14s
2017-08-18 09:23:37 (3.00 KB/s) - Connection closed at byte 43334. Retrying.
--2017-08-18 09:23:39-- (try: 3) http://8.8.8.8:3000/send
Connecting to 8.8.8.8 (8.8.8.8)|8.8.8.8|:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19189239 (18M)
Saving to: ‘send.1’ --- 5.55K 3.00KB/s Tried the v7.10.1 binary and it seems to timeout at about 10 minutes per server timeout.
Tried with v8.0.0 binary, and it seems to fail at 15 seconds like before. > wget http://8.8.8.8:3000/send --limit-rate=3k
--2017-08-18 09:49:55-- http://8.8.8.8:3000/send
Resolving 8.8.8.8 (8.8.8.8)... 8.8.8.8
Connecting to 8.8.8.8 (8.8.8.8)|8.8.8.8|:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19189239 (18M)
Saving to: ‘send.1’ --- 40.90K 3.00KB/s in 14s
2017-08-18 09:50:08 (3.00 KB/s) - Connection closed at byte 41886. Retrying.
--2017-08-18 09:50:09-- (try: 2) http://8.8.8.8:3000/send
Connecting to 8.8.8.8 (8.8.8.8)|8.8.8.8|:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19189239 (18M)
Saving to: ‘send.1’ --- 42.32K 3.00KB/s in 14s
2017-08-18 09:50:23 (3.00 KB/s) - Connection closed at byte 43334. Retrying.
--2017-08-18 09:50:25-- (try: 3) http://8.8.8.8:3000/send
Connecting to 8.8.8.8 (8.8.8.8)|8.8.8.8|:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19189239 (18M)
Saving to: ‘send.1’ --- 42.32K 3.00KB/s in 14s
2017-08-18 09:50:40 (3.00 KB/s) - Connection closed at byte 43334. Retrying. |
same issue node v8.4.0 |
@mtraynham it seems to be related to this commit: a7f5c9c
will fix your test |
Executing a request from an external IP address, results in a closed connection after about 5 - 20 seconds when the
Content-Length
header is set. WhenContent-Length
is not set, it seems ok.Executing a request locally always seems to respect the server timeout regardless of
Content-Length
.This works correctly in Node 7.10.1.
Using the following code (thanks to Doug Wilson at ExpressJS):
I've changed my IPs here to Google's...
It works when you don't set the
Content-Length
header:> wget 8.8.8.8:3000/sendNoLength --limit-rate=5k --2017-08-16 18:22:49-- http://8.8.8.8:3000/sendNoLength Connecting to 8.8.8.8:3000... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified Saving to: “sendNoLength” 2017-08-16 18:25:52 (5.00 KB/s) - “sendNoLength” saved [938848]
Paper trail of how I got here
angular/angular-cli#7197
webpack/webpack-dev-server#1044
expressjs/express#3392
The text was updated successfully, but these errors were encountered: