How a missing log server froze my Go backend
A postmortem from the RUNG backend, October and November 2026.
Symptoms
- The backend accepted TCP connections but never returned an HTTP response
- The health check timed out and the container showed as unhealthy
- The application stopped producing logs, while the process stayed alive
docker restartanddocker rm -fhung
Cause
I had removed the Grafana and Loki stack from the server to save memory. The Docker Loki logging plugin was still enabled, and containers were still sending their output through it, in the default blocking mode.
With nowhere to send logs, the buffer filled. After that, a write to stdout blocked. A chatty Go server writes to stdout from most places that matter, so the whole process stopped making progress.
restart: unless-stopped didn't help, because it reacts to a process exiting. This one never exited.
Why the first fix didn't hold
I set non-blocking delivery as the default in daemon.json. Days later it froze again, for two reasons:
- A daemon default applies only after the daemon restarts, and only to containers created after that. I hadn't restarted it.
- My Compose files set the Loki driver and its options explicitly, without
mode. Those per-service settings override the daemon default.
The setting that was missing
logging:
driver: loki
options:
loki-url: "http://loki.example:3100/loki/api/v1/push"
mode: "non-blocking"
max-buffer-size: "4m"
In non-blocking mode, a full buffer drops log lines. For this service, losing logs is far better than losing the service.
It could still hang on shutdown
A few days later a deploy hung while draining the old container: the plugin tries to flush buffered logs on teardown, and with Loki unreachable, stopping the container never returned. My deploy script now starts containers with the local json-file driver and rotation, and puts a hard timeout on the stop. Loki can come back when there is a Loki server to receive it.
What I check now
- Before removing any service, I look for what depends on it, including log drivers and metrics sinks that never appear in application code.
- I ask what happens when a dependency disappears. A write that can block forever is the dangerous case.
- I verify the configuration of the running container, not only the file I edited.
- Restart policies don't catch hangs, so health needs to be watched from outside.
Have a service that hangs and leaves no clues?
Email haiderzamanusafxay@gmail.com and tell me what's going on.