-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Caddy will not gracefully stop when SSH is proxied #258
Comments
One thing to note, unless it's in the But I'll try to find out why it's not closing connections. |
Are there any logs when you send a signal to Caddy? I guess |
Its using the admin interface to tell caddy to stop. So its sending the stop/restart/reload directly to the socket where Caddy listens on the Admin Endpoint. |
Here's the logfiles. It will hang indefinitely after
Full log from initial reload till stop while SSH is active:
|
I can confirm the issue on Windows, both if I send a POST to 127.0.0.1:2019/stop and when I press a stop button in my IDE (i.e. SIGINT) - Caddy won't stop, an SSH connection keeps working. My sample config:
Update 1:
Update 2:
Update 3:
Update 4:
|
That it will not stop with continous http traffic is also something I have user reports from, but mostly from the caddy ntml plugin and exchange servers. I dont know if its an related issue. It has been around that time I noticed stop/reload inconsistencies while using the layer4 module too. |
I've built with
The open SSH connection gets closed now and caddy stops. But it seems caddy stops due to a panic, and not gracefully. Here are what I have in the logs:
|
@Monviech I pushed a new commit, test if now it's fixed. You may need to clean the go mod cache, or clone that branch locally to ensure latest commits. |
@WeidiDeng I've built with the new commit and deleted cache and tried it out. Now Caddy is hanging again at this:
and the ssh connection stays open. When I manually close the SSH connection caddy will stop. |
@Monviech Now, try it again. |
@WeidiDeng Caddy stopped gracefully and closed the ssh connection. No errors in the logs.
|
Confirm Caddy stops successfully and closes HTTP connections with #261. Thank you, @WeidiDeng! |
Caddy will hang indefinitely on stop with this setup:
https://docs.opnsense.org/manual/how-tos/caddy.html#ssh-multiplexing-on-https-port
User report:
https://forum.opnsense.org/index.php?topic=38714.msg217113#msg217113
My own minimal test case to reproduce it (on FreeBSD 14.1):
caddy-l4 version used: bdee6a6
Open SSH connection:
ssh [email protected] -p 8443
Try to stop caddy:
service caddy stop
Caddy will hang indefinitely or until the SSH connection is disconnected. The
grace_period
will not kill this context for layer4 proxy.Expected behavior:
Any Layer 4 proxy will adhere to the
grace_period
on SIGTERM and disconnect all connections so caddy can stop.The text was updated successfully, but these errors were encountered: