Member-only story
The Spring Boot Memory Leak Nobody Talks About
Our Spring Boot app was restarting itself every 6 hours.
No errors. No exceptions. Just a silent crash at 4AM, 10AM, 4PM, 10PM. Like clockwork.
We thought it was AWS. Then we blamed Docker. Then we rewrote half the codebase.
🧩 If you enjoy these deep-dive stories, you might like some of the notes I keep around while working on Spring systems:
• Grokking the Spring Boot Interview → https://gumroad.com/a/134347923/hrUXKY
• Spring Boot Troubleshooting Cheatsheet → https://gumroad.com/a/416513171/ggwlgd
• 250+ Spring Certification Practice Questions → https://gumroad.com/a/134347923/sygyq
These have saved me countless hours chasing weird bean issues and context reload bugs.
The real culprit? A single @Scheduled annotation and Spring's dirty little secret about thread pools.
How It Started: The Innocent Cron Job
We needed a background job. Something simple. Clean up expired sessions every 5 minutes.
@Component
public class SessionCleanupJob {
@Scheduled(fixedRate = 300000) // 5 minutes
public void cleanupExpiredSessions() {
sessionRepository.deleteExpiredSessions()…