Mert Özen Further With Every Line

Blog

Mert Özen's blog posts on software development, backend, frontend, and DevOps.

Series
3 posts found #graceful-shutdown
Graceful Shutdown: SIGTERM, terminationGracePeriodSeconds, preStop and .NET HostOptions
DevOps PART 10

Graceful Shutdown: SIGTERM, terminationGracePeriodSeconds, preStop and .NET HostOptions

When a pod is deleted, SIGTERM and removal from endpoints start at the same time with no synchronization; that race caused 23 to 26 errors in an otherwise correct rollout, and a 5-second preStop sleep action brought it to zero. With real output we watch .NET finish requests and BackgroundServices in order on SIGTERM, see how ShutdownTimeout and the grace period cut each other off, and why exec sleep fails in a chiseled image.

8 Nov 2026 8 min 1
Prerequisites for Zero Downtime: Graceful Shutdown, Readiness, Stateless Apps and Backward Compatibility
DevOps PART 02

Prerequisites for Zero Downtime: Graceful Shutdown, Readiness, Stateless Apps and Backward Compatibility

No deployment strategy can save an app that doesn't finish its work when stopping and doesn't tell the truth about being ready. With real runs: a 5 s request is cut with an RST when ShutdownTimeout is 2 s, Docker's 1 s wait produces exit code 137 (SIGKILL), readiness returns 503 during the drain while the API keeps serving 200, separate Data Protection key rings throw CryptographicException, and a deleted Angular chunk turns into a ChunkLoadError.

8 Nov 2026 13 min 3
IHostedService and BackgroundService in .NET: Lifecycle, Graceful Shutdown and the .NET 10 Behavior Change
Backend PART 02

IHostedService and BackgroundService in .NET: Lifecycle, Graceful Shutdown and the .NET 10 Behavior Change

In .NET 10 the whole of BackgroundService.ExecuteAsync runs in the background; code before the first await no longer blocks startup, and code that must run early moves to StartAsync or IHostedLifecycleService. On shutdown the host cancels stoppingToken and gives all stopping work a default 30-second ShutdownTimeout; work that ignores the token is cut off at the end of that window without even a log line.

8 Nov 2026 11 min 4
Blog Map