1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

sigtrap: always ignore SIGPIPE (#6645)

This commit is contained in:
Kévin Dunglas 2024-10-19 15:33:50 +02:00 committed by GitHub
parent 388c7e898c
commit b443190b66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -28,6 +28,10 @@ import (
// trapSignalsPosix captures POSIX-only signals. // trapSignalsPosix captures POSIX-only signals.
func trapSignalsPosix() { 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() { go func() {
sigchan := make(chan os.Signal, 1) sigchan := make(chan os.Signal, 1)
signal.Notify(sigchan, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGUSR1, syscall.SIGUSR2) signal.Notify(sigchan, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGUSR1, syscall.SIGUSR2)