Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

Apache logs SIGWINCH and exits on its own

Errorcaught SIGWINCH, shutting down gracefully

Short answer

SIGWINCH is Apache's graceful-stop signal. The line means something asked httpd to finish current requests and exit, not that it crashed. In a Docker container the official image makes this the stop signal, so docker stop, compose down or an orchestrator sends it. On a normal server, look for a script or admin that ran graceful-stop.

  • Applies to Apache httpd 2.4, Docker Engine 28, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Check whether Apache runs in a container or on the host, and read the exit state. A clean stop with no error before it points to a requested shutdown, not a fault.

    docker ps -a --filter name=my-apache --format '{{.Names}} {{.Status}}'
    sudo tail -n 20 /var/log/apache2/error.log
  2. 2Match what you see, then jump to its fix

    1. 1the message is the last line in docker logs, and the container stopped without any error before itDocker, compose or an orchestrator stopped the containerFix
    2. 2no container is involved, and the shutdown time matches a script run, a deploy or a manual commandSomeone or a script ran graceful-stop on the hostFix

What does the error look like?

  • caught SIGWINCH, shutting down gracefully
  • the httpd container stops although nothing crashed

Cause 1 of 2

Docker, compose or an orchestrator stopped the container

1Check

The official httpd image sets STOPSIGNAL SIGWINCH. Docker sends the image's configured stop signal first and only uses SIGTERM when none is set, so every normal stop reaches Apache as a graceful stop. Look for who stopped it: a docker stop, a compose down or restart, a deploy, a health check or a node drain.

docker inspect --format '{{.Config.StopSignal}}' my-apache
docker logs --tail 20 my-apache

2Fix

Nothing in Apache is broken. Find the stop in your deploy or orchestration logs and, if it was not meant to happen, fix that trigger. Set a restart policy in your compose file so the container comes back after a stop you did not plan.

# in docker-compose.yml, under the service
restart: unless-stopped

3Verify

Start the container again and confirm it stays up under the same workflow.

docker ps --filter name=my-apache

Confirmed by docs.docker.com

Did this fix it?

Cause 2 of 2

Someone or a script ran graceful-stop on the host

1Check

In Apache the WINCH signal and apachectl -k graceful-stop are the same thing. The parent removes its PID file, stops listening and exits once its children finish. Search your scripts, cron jobs and shell history for it.

sudo grep -R "graceful-stop\|SIGWINCH\|kill -WINCH" /etc /usr/local/bin /opt 2>/dev/null
grep -n "graceful-stop" ~/.bash_history

2Fix

Replace the call with graceful (apachectl -k graceful) when you want a reload with no downtime, since that signal starts a new generation of workers instead of exiting.

sudo apachectl -k graceful

3Verify

Run the changed script and check that httpd keeps running afterwards.

pgrep -a httpd || pgrep -a apache2

Confirmed by httpd.apache.org

Did this fix it?

How do I stop it coming back?

  • Use graceful, not graceful-stop, in deploy scripts that must keep the site online.
  • Add a restart policy to containers and an uptime check that alerts when the web server is down.
  • Log who runs stop commands in your deploy tooling so an unexpected shutdown can be traced.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Servers

A dev container port does not open in the browser when Docker runs on a remote host

If your application only accepts calls from localhost, it will reject connections from published ports

Three things usually break it: the app listens only on localhost inside the container, so published ports are rejected; you open the container port instead of the mapped localhost port VS Code shows; or you changed appPort or a Compose ports list and did not rebuild.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.