Caddy: [Bug?] Caddy closes connection prematurely

Created on 22 Mar 2017  路  5Comments  路  Source: caddyserver/caddy

(Are you asking for help with using Caddy? Please use our forum instead: https://forum.caddyserver.com. If you are filing a bug report, please answer the following questions. If your issue is not a bug report, you do not need to use this template. Either way, please consider donating if we've helped you. Thanks!)

1. What version of Caddy are you running (caddy -version)?

Caddy 0.9.5

2. What are you trying to do?

wget a file from caddy:

image

3. What is your entire Caddyfile?

10.20.0.14:8080
log

4. How did you run Caddy (give the full command and describe the execution environment)?

Windows 7. Caddy executed via caddy.exe with no parameters

5. What did you expect to see?

Expected the file to download successfully.

6. What did you see instead (give full error messages and/or log)?

The file is downloaded partially. Caddy closes the connection (normally) before the entire file is sent (see wget output).

HTTP Request and response, captured using Wireshark (note the correct Content-Length):

GET REMOVED HTTP/1.1
Host: 10.20.0.14:8080
User-Agent: Wget
Connection: close

HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 9609193
Content-Type: application/zip
Etag: W/"58d245a8-929fe9"
Last-Modified: Wed, 22 Mar 2017 09:36:40 GMT
Server: Caddy
Date: Wed, 22 Mar 2017 09:58:53 GMT
Connection: close

Caddy closes the connection normally after about 8MB of data:

image

The access log shows a 200 response, with the incorrect response size:

10.20.0.6 - [22/Mar/2017:11:59:13 +0200] "GET REMOVED HTTP/1.1" 200 8617984

7. How can someone who is starting from scratch reproduce this behavior as minimally as possible?

Not sure. It happens on my machine all the time with files larger than a few megabytes. But I'm guessing that if caddy had a constant issue with serving files over a given size, someone would have caught it by now.

duplicate invalid

Most helpful comment

@tobya Thanks. I'll try it out.

But even with these timeouts, why should caddy timeout during an active file transfer? This doesn't sound like a problem with the default values; it sounds like a problem with the way in which timeouts are implemented.

Also, such errors should probably be logged somewhere...

All 5 comments

@MaltAlex This may be to do with default timeouts - in 0.9.5 caddy has default timeouts set which create issues similar to this. We have decided to remove default timeouts in 0.9.6.

for the moment a workaround is to supply a caddyfile with timeouts specified as off

mydomain.com {
timeouts none
}

If this doesn't fix your issue please feel free to let us know.

@tobya Thanks. I'll try it out.

But even with these timeouts, why should caddy timeout during an active file transfer? This doesn't sound like a problem with the default values; it sounds like a problem with the way in which timeouts are implemented.

Also, such errors should probably be logged somewhere...

@tobya yeah, that solved the problem

Thanks to all of you guys, this solved my problem too. BTW my caddy version is the very 0.9.5 :)

You should update to the latest version of Caddy

Was this page helpful?
0 / 5 - 0 ratings