The Memory Leak Nobody Else Could Find

The Memory Leak Nobody Else Could Find How a performance engineer learned that the worst production problems are the ones that take hours to appear, and why he now plans for them from day one.
A server stops responding under load. Requests pile up and time out. There are no errors in the logs. The strangest part: CPU on that server has dropped to almost nothing. A restart clears it every time, which is why, after three weeks and two or three load test cycles, the team had come to treat it as an environment quirk. The hang showed up maybe once in every two or three runs, and only at the highest load levels. Someone had already increased the database connection pool, the problem had gone quiet for a cycle, and it was marked as resolved.
Then it came back during the final peak-load test before the release.
That is the point at which Naresh Padakanti was asked to look at it. Padakanti is an SAP Performance Engineer with sixteen years in IT and more than ten years focused on performance for SAP Hybris, now SAP Commerce, and SAP CRM. He is the person teams call when a high-traffic commerce platform slows down and nobody can pin down why. In this case, what he changed first was not technical. It was the process. The next time a server hung, nobody was to restart it until he had captured thread dumps.
“Intermittent problems that disappear on restart are the hardest kind, because restarting destroys the evidence,” he says.
With three or four dumps taken about ten seconds apart, the pattern was clear. Dozens of threads were in a blocked state, all waiting for the same lock on a shared in-memory cache. On its own, that looked like heavy contention, slow but not stuck. So he searched the dump for the thread that held the lock. He expected to find it busy, maybe running a slow query. Instead, it was sitting in the connection pool, waiting for a database connection.
Then he went back through the blocked threads and checked what each one was holding. Every one of them had a database connection checked out, and every one was waiting for the cache lock. The thread with the lock needed a connection. Every thread with a connection needed the lock. The second dump, ten seconds later, was identical. Nothing had moved.
It was not a classic two-lock deadlock, which is why automatic deadlock detection had not flagged it. It was a lock and a connection pool waiting on each other. That single observation explained everything at once: why CPU was near zero, why database sessions were idle, why nothing appeared in the logs, and why a larger pool had made the problem rarer without removing it. More connections meant the collision happened less often. It did not change the fact that, once it happened, nothing could move.
The fix was to stop holding the lock while fetching data. The cache refresh now loaded data from the database first, then took the lock only briefly to swap in the new values. He also added a timeout on getting a connection, so that if something similar happened again it would fail with a clear error instead of hanging silently. By his account, the same peak load test was re-run several times and the hang never came back.
“When a server is slow but its CPU is idle, it’s not working hard,” he says. “It’s waiting on something. That’s when thread dumps tell you more than any dashboard.”
A separate case, on a different platform, taught him a related lesson about garbage collection. For a storefront, he explains, the priority is short pauses rather than maximum throughput. A shopper notices a three-second freeze. A few percent of extra CPU, nobody sees. His target on that engagement was no GC pause over about 300 milliseconds at peak load, with a stable heap over an eight-hour endurance test. The rules were simple: change one thing at a time, run the same load test with the same data each time, and turn on GC logging for every run.
The baseline was Parallel GC with an 8 GB heap. Throughput was fine, but full GC pauses reached three to four seconds at peak and response times spiked with them. CMS looked much better at first, until, over a long run, memory fragmented and the collector fell back to a long full GC. “Fine in a one-hour test and bad in an eight-hour one,” he says. G1 at default settings was better again, with occasional pauses over a second during heavy periods. G1 with a 200-millisecond pause target met the goal most of the time, but GC ran more often and heap was tight at peak. The configuration that held was G1 with a 12 GB heap and an earlier trigger for background collection, around 35 percent heap occupancy rather than the default 45. The extra headroom plus starting cleanup earlier removed the remaining long pauses. He validated it with a full eight-hour endurance test and a spike test, and checked with the Basis team that the servers could carry the larger heap.
What stayed with him was less the setting than the shape of the search. CMS had looked excellent for an hour. A memory leak on an earlier engagement had only appeared after three. A short peak-load test would have passed both, and production would have found them instead.
The reaction when the fix held was, he recalls, relief more than celebration. The release had been at risk and the client’s technical lead had been worried about peak season. The dev lead’s message to the group was roughly that it was the first long run in weeks where nobody had to restart anything. The response that mattered more came afterwards. The client’s architect asked him to write up the GC configuration and the reasoning behind each setting, and that became the standard JVM configuration for their application servers. The eight-hour endurance test was made a required step before every major release, not something kept in reserve for when a problem was suspected.
“A fix helps one release,” he says. “A change in how the team tests helps every release after it.”
That is the lesson he now carries into every new project. Test long, not just hard. He puts an endurance test in the plan from day one, usually six to eight hours at realistic load, agreed with the project manager early because it is the first thing people want to cut when the schedule gets tight. He turns on GC logging and production-equivalent JVM settings in the performance environment before the first test, so that when something drifts over hours there is already evidence to read rather than a condition to reproduce. And he agrees in advance on what happens when a server hangs: thread dumps and a heap dump before anyone restarts it.
None of it costs much. Together, he says, it means the slow-building problems, the ones that cause the worst production incidents, show up in a test environment instead of a live one.
More from Tom Allen
See all
Enterprise AIThe 80% Problem: A Production-Readiness Framework for Enterprise AI Pilots That Actually Ship
AI & TechnologyHow Hiver Kept Reinventing Customer Support

Transforming Hospital Connectivity via Advanced Network Engineering Expertise
Enterprise AIBuilding Intelligent Distributed Systems for Enterprise Automation
Recommended for you
More stories
Enterprise AIGoodbye DevRel, Hello AgentRel: Who Decides Enterprise Tool Adoption When Coders Stop Browsing?
Cyber SecurityHow CISOs can ensure ‘business as usual’ in the quantum age: Cybersecurity Awareness Month 2026
AI & TechnologyWho Owns the AI Moat?
AI & TechnologyGovernment’s AI ambitions need to remove complexity first
AgenticBeyond the prompt: Why agentic AI demands role-specific skills and accountability
Data