aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKévin Dunglas <[email protected]>2024-10-19 15:33:50 +0200
committerGitHub <[email protected]>2024-10-19 07:33:50 -0600
commitb443190b66055089d1e112abc992512ca4f6bfba (patch)
tree1f6cb37d768c4e434ceed415ef2c450be3c8883f
parent388c7e898c6cbcddd2c59e8a902238a0b4f06857 (diff)
downloadcaddy-b443190b66055089d1e112abc992512ca4f6bfba.tar.gz
caddy-b443190b66055089d1e112abc992512ca4f6bfba.zip
sigtrap: always ignore SIGPIPE (#6645)
-rw-r--r--sigtrap_posix.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/sigtrap_posix.go b/sigtrap_posix.go
index 7033f1635..2c6306121 100644
--- a/sigtrap_posix.go
+++ b/sigtrap_posix.go
@@ -28,6 +28,10 @@ import (
// trapSignalsPosix captures POSIX-only signals.
func trapSignalsPosix() {
+ // Ignore all SIGPIPE signals to prevent weird issues with systemd: https://github.com/dunglas/frankenphp/issues/1020
+ // Docker/Moby has a similar hack: https://github.com/moby/moby/blob/d828b032a87606ae34267e349bf7f7ccb1f6495a/cmd/dockerd/docker.go#L87-L90
+ signal.Ignore(syscall.SIGPIPE)
+
go func() {
sigchan := make(chan os.Signal, 1)
signal.Notify(sigchan, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGUSR1, syscall.SIGUSR2)