Skip to content
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

panic: close of closed channel after running caddy stop #6707

Closed
voltagex opened this issue Nov 24, 2024 · 3 comments
Closed

panic: close of closed channel after running caddy stop #6707

voltagex opened this issue Nov 24, 2024 · 3 comments
Labels
bug 🐞 Something isn't working
Milestone

Comments

@voltagex
Copy link

v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk= on aarch64 - cross compiled with xcaddy

panic: close of closed channel

goroutine 21 [running]:
github.com/caddyserver/caddy/v2/modules/caddytls.(*TLS).Stop(0x40002ff2c0)
        github.com/caddyserver/caddy/[email protected]/modules/caddytls/tls.go:338 +0x2c
github.com/caddyserver/caddy/v2.unsyncedStop({{0x1970cc0, 0x4000557b30}, 0x40002b0270, 0x40003c2780, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, ...})                                                                                                            github.com/caddyserver/caddy/[email protected]/caddy.go:677 +0xcc
github.com/caddyserver/caddy/v2.Stop()
        github.com/caddyserver/caddy/[email protected]/caddy.go:646 +0x138
github.com/caddyserver/caddy/v2.exitProcess({0x1970c50, 0x26037c0}, 0x4000982300)
        github.com/caddyserver/caddy/[email protected]/caddy.go:721 +0x248
github.com/caddyserver/caddy/v2.exitProcessFromSignal({0x1443925, 0x7})                                                         github.com/caddyserver/caddy/[email protected]/sigtrap.go:59 +0xe4
github.com/caddyserver/caddy/v2.trapSignalsPosix.func1()
        github.com/caddyserver/caddy/[email protected]/sigtrap_posix.go:44 +0x4f8
created by github.com/caddyserver/caddy/v2.trapSignalsPosix in goroutine 1
        github.com/caddyserver/caddy/[email protected]/sigtrap_posix.go:31 +0x24

I'm not sure I can reproduce this but I don't think I've seen it before.

@mholt
Copy link
Member

mholt commented Dec 30, 2024

Thanks for the report. Sorry I have not replied until now.

Do you have any further details about reproducing it? It's almost like the server was stopped twice somehow.

@mholt mholt added bug 🐞 Something isn't working needs info 📭 Requires more information labels Dec 30, 2024
@voltagex
Copy link
Author

It was on an OpenWrt system, all /etc/init.d/caddy stop did was run 'caddy stop'! The only thing I can think of is that the system sent a SIGTERM or similar while Caddy was in the middle of stopping.

@mholt mholt closed this as completed in 34cff4a Dec 31, 2024
@mholt
Copy link
Member

mholt commented Dec 31, 2024

Hm, I guess that's possible. Turns out I wasn't doing an atomic CompareAndSwap for exiting. Thanks, hopefully that commit fixes it!

@mholt mholt removed the needs info 📭 Requires more information label Dec 31, 2024
@mholt mholt added this to the v2.9.1 milestone Dec 31, 2024
@caddyserver caddyserver deleted a comment from Devilisrabits Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants