← Haider Zaman

How a missing log server froze my Go backend

A postmortem from the RUNG backend, October and November 2026.

Symptoms

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:

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

Have a service that hangs and leaves no clues?

Email haiderzamanusafxay@gmail.com and tell me what's going on.