Caddy Service Keeps Stopping

(J. Scott Elblein) #1

Using Caddy 0.11.5, for some reason Caddy keeps crashing (service keeps stopping). The logs show this:

2019/04/16 14:28:28 http: TLS handshake error from 192.168.0.195:51117: EOF
2019/04/16 14:29:28 http: TLS handshake error from 192.168.0.195:51139: EOF
2019/04/16 14:30:28 http: TLS handshake error from 192.168.0.195:51154: EOF
2019/04/16 14:31:28 http: TLS handshake error from 192.168.0.195:51181: EOF
2019/04/16 14:32:28 http: TLS handshake error from 192.168.0.195:51199: EOF
2019/04/16 14:33:28 http: TLS handshake error from 192.168.0.195:51225: EOF
2019/04/16 14:34:28 http: TLS handshake error from 192.168.0.195:51239: EOF
2019/04/16 14:35:28 http: TLS handshake error from 192.168.0.195:51255: EOF
2019/04/16 14:36:28 http: TLS handshake error from 192.168.0.195:51269: EOF
2019/04/16 14:37:28 http: TLS handshake error from 192.168.0.195:51286: EOF
2019/04/16 14:38:28 http: TLS handshake error from 192.168.0.195:51341: EOF
2019/04/16 14:39:27 http: TLS handshake error from 192.168.0.195:51370: EOF
2019/04/16 14:40:27 http: TLS handshake error from 192.168.0.195:51385: EOF
2019/04/16 14:41:27 http: TLS handshake error from 192.168.0.195:51403: EOF
2019/04/16 14:42:28 http: TLS handshake error from 192.168.0.195:51420: EOF
2019/04/16 14:43:28 http: TLS handshake error from 192.168.0.195:51444: EOF
2019/04/16 14:43:58 [INFO][FileStorage:C:\Windows\system32\config\systemprofile\.caddy] Started certificate maintenance routine
2019/04/16 14:43:58 [INFO] Serving http://my.domain.rocks 
2019/04/16 14:43:58 [INFO] Serving https://my.domain.rocks:3999 
2019/04/16 14:43:58 [INFO] Nonblocking Command "C:\Servers\PHP\7.2.12\php-cgi.exe -b localhost:9133" with ID abf982e9-ea8d-481d-b141-424bb81d1f1a
2019/04/16 14:44:28 http: TLS handshake error from 192.168.0.195:51466: EOF
2019/04/16 14:48:55 [INFO][FileStorage:C:\Windows\system32\config\systemprofile\.caddy] Started certificate maintenance routine
2019/04/16 14:48:55 [INFO] Serving https://my.domain.rocks:3999 
2019/04/16 14:48:55 [INFO] Serving http://my.domain.rocks 
2019/04/16 14:48:55 [INFO] Nonblocking Command "C:\Servers\PHP\7.2.12\php-cgi.exe -b localhost:9133" with ID 082ad26c-8e2e-4912-b1b4-05379a940596
2019/04/16 14:49:28 http: TLS handshake error from 192.168.0.195:51561: EOF
2019/04/16 14:49:55 [INFO][FileStorage:C:\Windows\system32\config\systemprofile\.caddy] Started certificate maintenance routine
2019/04/16 14:49:55 [INFO] Serving http://my.domain.rocks 
2019/04/16 14:49:55 [INFO] Serving https://my.domain.rocks:3999 
2019/04/16 14:49:55 [INFO] Nonblocking Command "C:\Servers\PHP\7.2.12\php-cgi.exe -b localhost:9133" with ID 0484c337-f2be-42b0-b663-a5166624a7bb
2019/04/16 14:50:28 http: TLS handshake error from 192.168.0.195:51577: EOF
2019/04/16 14:51:28 [INFO][FileStorage:C:\Windows\system32\config\systemprofile\.caddy] Started certificate maintenance routine
2019/04/16 14:51:28 [INFO] Serving https://my.domain.rocks:3999 
2019/04/16 14:51:28 [INFO] Serving http://my.domain.rocks 
2019/04/16 14:51:28 [INFO] Nonblocking Command "C:\Servers\PHP\7.2.12\php-cgi.exe -b localhost:9133" with ID 7d556cbd-b54b-4792-ae58-e1e929e43028
2019/04/16 14:51:30 http: TLS handshake error from 192.168.0.195:51591: EOF
2019/04/16 14:51:38 [INFO][FileStorage:C:\Windows\system32\config\systemprofile\.caddy] Started certificate maintenance routine
2019/04/16 14:51:38 [INFO] Serving https://my.domain.rocks:3999 
2019/04/16 14:51:38 [INFO] Serving http://my.domain.rocks 
2019/04/16 14:51:38 [INFO] Nonblocking Command "C:\Servers\PHP\7.2.12\php-cgi.exe -b localhost:9133" with ID 51220703-0e5a-45dd-b91a-11d783453f81
2019/04/16 14:52:28 http: TLS handshake error from 192.168.0.195:51611: EOF

Some Notes:

  • Where it shows the FileStorage lines is where I start the caddy service again.
  • The IP 192.168.0.195 is a LAN machine that isn’t the one where Caddy is running.

Any ideas? Matthew? :stuck_out_tongue:

(Matthew Fay) #2

Can’t think of why Caddy would be quitting without anything in the process log. Everything short of a downright process kill results in some output, as far as I know.

My hunch is that it’ll be something to do with the Windows service management.

(Magikstm) #3

How do you start PHP?

Could you please share your entire caddyfile?

(J. Scott Elblein) #4

Hi @magikstm

Here’s my entire caddyfile at the moment.

It’s kinda weird, there’s no real hint as far as I can tell in any of the caddy logs. It’s like it just poops out before it gets the chance to output the error to the log (or something).

(Magikstm) #5

It may be related to issues mentioned in these two links:


I would change caddyfile as suggested and see if it corrects the issue.

2 Likes
(J. Scott Elblein) #6

Thanks @magikstm. That sounds similar to what I have been doing, except it looks like you’re setting unlimited requests (unless using the second looping version of the bat file). It kinda seems like all of those TLS errors may be flooding the max requests, and perhaps causing them to crash real soon.

(btw, any suggestions on quickly identifying exactly what’s sending all of those TLS request failures from the other LAN machine short of running a sniffer in it? afaik there’s nothing on it overtly trying to connect to Caddy from it, so it’s happening somewhere in the background evidently). It’d be kinda nice if the error included a browser user agent string or something.

I had read this thread a while ago which recommends setting 2 environment vars; 1 telling PHP to spawn multiple processes, but with less max requests. Link

It had been working fine until recently, but your comment refreshed my memory on the issue, so I’m going to try bumping up my current max requests from 128 to something higher and see if it helps. If that doesn’t do it, I’m gonna give your solution a shot.

Thanks for the help! :+1:

(J. Scott Elblein) #7

Unfortunately no matter what method I use to start/call PHP from the caddyfile the result is still the same. I think I might be bumping into this issue.