In this article
Both Loki servers now exclude one another from shutdown wait dependencies, removing the cycle present when the internal server was enabled.
Loki 3.7.10 fixes shutdown hanging when internal_server.enable is set. The public and internal server services each waited for the other to terminate before shutting their own listeners down. Both waits were individually plausible but together formed a cycle. The patch shares a dependency-selection method that excludes both server services, allowing shutdown to progress instead of waiting until an external mechanism kills the process.
Two reasonable wait lists formed a cycle
PR 25721 explains that each NewServerService stopping function waited for servicesToWaitFor before calling Shutdown on its listeners. The public list excluded only itself and the internal list did likewise. Simultaneous stop therefore left each waiting on the other’s termination. A review should inspect the dependency graph, not only whether each service excludes itself. Shared lifecycle helpers can still create cycles when their caller-specific exclusions are incomplete.
Enable the optional server in qualification
The release explicitly scopes the hang to internal_server.enable. A default deployment without that server can exit normally and provide no evidence about the repaired path. A proposed test starts both servers, sends the normal termination signal and observes listener closure and process exit. Capture the effective setting so a passing result is not accidentally obtained with the optional module disabled. Keep external kill timers visible as a separate outcome.
Grace-period expiry can conceal application failure
An orchestrator eventually removing a Pod is not proof that Loki completed graceful shutdown. The old behavior could persist until something else killed it. A qualification record should distinguish voluntary exit from forced termination and retain module shutdown logs. The release does not publish an upper bound for all shutdown operations. Any timeout chosen for a test should account for the actual configured workload and independently justified operational expectations.
Removing one cycle does not validate every dependency
The shared serverServicesToWaitFor method excludes both servers while retaining other services that must finish first. A blanket removal of all waits would also avoid the cycle but weaken shutdown ordering. Review and tests should preserve those remaining dependencies. The patch fixes one deadlock; it does not establish that data flushing, ingestion draining or every external dependency completes successfully. Those outcomes need their own evidence when qualifying a rollout.
Sources
- grafana/loki v3.7.10 release notes
- fix(loki): Resolve deadlock on shutdown when the internal server is enabled [release-3.7.x] by jnewbigin
Related reading
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.