Production Case Studies: Concurrency, Deadlocks & System Bottlenecks (Incidents 41-50)
10 rigorous production incident postmortems covering zero-downtime failures, concurrent payment races, noisy neighbors, port exhaustion, and auth lockouts.
The final ten incident postmortems tackle the hardest concurrency bugs, port leaks, noisy neighbor monopolizations, and catastrophic authentication service outages that brought major production platforms to their knees.
01Incident 41: Zero-Downtime Architecture Breach
1. Title
SIGTERM Termination Drops 8,400 In-Flight HTTP Requests During Rolling Deployment.
2. Incident ID
INC-2026-041
3. Severity
P1 (Failed Zero-Downtime Guarantee).
4. Affected Services
order-service (all instances).
5. Trigger
Kubernetes rolling deployment to deploy patch release.
6. Symptoms
Users received 502 Bad Gateway and Connection reset by peer precisely when pods were terminating.
7. Detection Mechanism
Sentry flagged 8,400 dropped TCP connection errors in 90 seconds.
8. Root Cause Analysis
When Kubernetes terminates an old pod during a rolling update, two things happen asynchronously:
- The pod receives a
SIGTERMsignal. - The endpoint controller removes the pod IP from the Service and Ingress load balancers.
Because endpoint removal propagates through kube-proxy with a 2-5 second delay, the load balancer continued routing new incoming HTTP requests to the pod after the JVM received SIGTERM. Because Spring Boot was not configured with graceful shutdown and Kubernetes had no
preStopsleep hook, the JVM terminated immediately, dropping all active TCP sockets.
9. Blast Radius
8,400 user requests dropped; corrupted shopping cart checkout state.
10. Short-term Mitigation
Manually halted deployments during peak hours.
11. Long-term Architectural Fix
Configure Spring Boot Graceful Shutdown (server.shutdown=graceful) combined with a Kubernetes preStop hook of sleep 15 to ensure load balancers deregister the pod before the JVM starts shutting down.
12. Architecture Flaw
Immediate container termination without synchronization with upstream load balancer deregistration.
13. Prevention Pattern
Graceful Shutdown & Kubernetes PreStop Drain Hook.
14. Complete Code or Configuration Example
# application.properties
server.shutdown=graceful
spring.lifecycle.timeout-per-shutdown-phase=30s# deployment.yaml
spec:
containers:
- name: order-service
lifecycle:
preStop:
exec:
# Sleep 15s allows ingress load balancers to remove pod IP before SIGTERM!
command: ["/bin/sh", "-c", "sleep 15"]15. Interview Follow-up Question
"Why is a preStop sleep hook necessary in Kubernetes even if Spring Boot has server.shutdown=graceful enabled?"
Answer: Kubernetes removes pod IPs from load balancers asynchronously. There is a multi-second delay while kube-proxy and cloud load balancers update routing tables. If the JVM begins shutting down immediately upon receiving SIGTERM, incoming requests routed during that propagation delay hit an unready pod. A preStop: sleep 15 hook gives the load balancer time to drain traffic before shutdown starts.
16. Lessons Learned
- True zero-downtime deployments require graceful shutdown AND a preStop drain delay.
Loading the rest of the lesson…