The Jenkins UI returns 503 and then "Jenkins is going to shut down"; the controller log shows `java.lang.OutOfMemoryError: Java heap space`.

IntermediateTroubleshootingPipeline outages
Answer

Likely causes → The controller is overloaded: builds run on the built-in node, thousands of retained builds and huge console logs are loaded into memory, or a plugin leaks memory. Heap is often still at a default that's too small.

Diagnose →

grep -i 'outofmemory' /var/log/jenkins/jenkins.log | tail
ls /var/lib/jenkins/jobs | wc -l
du -sh /var/lib/jenkins/jobs/*/builds | sort -h | tail
jcmd $(pgrep -f jenkins.war) GC.heap_info

Fix → Restart with a larger heap (JAVA_OPTS=-Xmx4g -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError), set the built-in node's executors to 0 so builds only run on agents, and discard old builds.

Prevent → Treat the controller as a scheduler only, keep build retention short, review plugins, back up JENKINS_HOME, and monitor heap via the Prometheus metrics plugin.

All Real-World Interview questions Roadmap: Interview readiness

More on Pipeline outages