Apache 2 stops working when the terminal window is resized?
I encountered an interesting Mastodon post. In it a user describes the problem that the Apache 2, which is running in foreground inside a docker container, stops when the terminal window is resized.
What?
And it is even written to the logfile:
[Mon Jan 12 17:38:14 2026] [notice] caught SIGWINCH, shutting down gracefully
Clearly this must be some strange bug regarding signal handling in Apache, right?
Turns out: No. This is just a misuse of the WINCH signal. Normally it signals a process that the terminal resolution has changed. The process can then adjust output etc.
But Apache uses the signal to initiate a graceful-stop. This is even documented under https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
"TheWINCHorgraceful-stopsignal causes the parent process to advise the children to exit after their current request [...]"
However, I would prefer if they would explicitly point out that they:
- Re-Use that signal to achieve a completely different thing
- Mention the possible implications this has if your Apache process is executed in the foreground