Java/Spring/JVM · Production incident
Out of memory every night
A service runs out of heap and restarts every night. How do you tell a leak from a heap that is too small?
Tuesday 09:30 · invoice-serviceIllustrative scenario, not a real incident
invoice-service: restarted at 02:41 after java.lang.OutOfMemoryError, the fifth night in a row
invoice-service runs on Java 21 with Spring Boot, G1 and -Xmx4g. For five nights it has thrown java.lang.OutOfMemoryError: Java heap space between 02:00 and 03:00 and been restarted.
Each crash drops the invoice batch that is running at the time, and the batch starts again from the beginning. A colleague has a change ready that raises the heap to 8 GB.
What the dashboards and logs show
- Restarts
- 5, one a night, between 02:07 and 02:52
- Maximum heap
- 4 GB
- Pod memory graph
- climbs through the day, drops at each restart
- Traffic
- the same weekday pattern for a month
Clarify · optional · scored under "Hypothesis before change"
Ask the interviewer
0 of 3 asked
Each question reveals a fact. What you ask before you act is part of your score.
First move · scored under "Mitigate before root cause"
Tonight's batch will be dropped again at about 02:40. What do you do first?
Your rubric score, the model answer, the follow-up questions and the related lessons appear once you have answered the last step.