🌪️ The Chaos Begins It was a normal day in production... until suddenly, one server started heating up 🔥. And I don’t mean metaphorically — its CPU usage shot up to 100% and stayed there, like it had chugged 10 cups of espresso ☕💥. No OutOfMemoryError. No Exceptions. No logs screaming for help. Just... silence and a fan spinning like a helicopter 🌀. 🧩 The Initial Clues We SSH'd into the server and ran: top -H -p <java_process_id> We noticed one thread hogging the CPU — continuously. Then we used VisualVM to peek inside. Stack trace of that CPU-hogging thread looked like this: at com.example.MyProcessor.process(MyProcessor.java:42) at com.example.MyProcessor.run(MyProcessor.java:30) ... Hmm… That class wasn’t doing anything fancy. Just a retry mechanism inside a loop. 🔍 The Suspect Code Here’s what the code looked like: while ( true ) { try { doSomeCriticalOperation(); break ; // Exit on success } catch (Exception e) { ...
A cozy space where I share my daily Java learnings, issues, and solutions.