Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 12, 07:00 UTC
sigtrap: always ignore SIGPIPE (#6645)
Kévin Dunglas committed
Oct 19, 2024 at 15:33 UTC
b443190b66055089d1e112abc992512ca4f6bfba
1 file changed
+4
sigtrap_posix.go
+4
@@ -28,6 +28,10 @@ import (
28
29
// trapSignalsPosix captures POSIX-only signals.
30
func trapSignalsPosix() {
31
+ // Ignore all SIGPIPE signals to prevent weird issues with systemd: https://github.com/dunglas/frankenphp/issues/1020
32
+ // Docker/Moby has a similar hack: https://github.com/moby/moby/blob/d828b032a87606ae34267e349bf7f7ccb1f6495a/cmd/dockerd/docker.go#L87-L90
33
+ signal.Ignore(syscall.SIGPIPE)
34
+
35
go func() {
36
sigchan := make(chan os.Signal, 1)
37
signal.Notify(sigchan, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGUSR1, syscall.SIGUSR2)