The Value of In-House Expertise
I&#x27;m not surprised that Twitter has those teams, I&#x27;m always surprised that more places don&#x27;t.  About 22 years ago I was the only person at the company I worked for at the time who could analyze Solaris core dumps, and understood enough about the JVM to diagnose deep problems.  In the 5 years until the rest of the engineering staff caught up to where they stopped needing me for every incident, I probably saved enough money to pay my salary 100x over.<p>Never saw a dime of that.  The one time someone offered me a spot bonus to come solve a problem, they reneged on it: A manager in charge of a project came to me for help. We&#x27;re crashing all the time, he says. IBM and the team can&#x27;t figure it out, he says. If you can solve this, I&#x27;ll give you a $5000 spot bonus, he says.<p>I would have done it anyway, because it&#x27;s my, you know, job? But whatever, I won&#x27;t turn down free money.<p>So I wander over to the team that&#x27;s been looking at this and get the lowdown. They keep getting out of memory errors.<p>Me: So what does the heapanalyzer output look like?
Team: Huh?<p>Me: You...you&#x27;ve been having out of memory errors and haven&#x27;t looked at the heap?
Team: Buh?<p>So I get the heapdump and look at it. Immediately it&#x27;s clear that the system is overflowing with http session objects.<p>Me: Anything in the log files related to sessions?
Team: Just these messages about null pointer exceptions during session cleanup...do you think they&#x27;re related somehow?
Me: &lt;Bangs head on desk&gt;<p>A little more research reveals that there were two issues at play. The first is that we had a custom HttpSessionListener that was doing some cleanup when sessions were unbound. It would sometimes throw an exception. We were using IBM WAS, and it turned out that when a sessionDestroyed method threw an exception, WAS would abort all session cleanup. So we&#x27;d wind up in a cycle: the session cleanup thread would start, process a few sessions, hit one that threw an exception on cleanup, and which would abort cleaning up any other sessions.<p>We did a quick fix of wrapping all the code in the sessionDestroyed method with a blanket try&#x2F;catch and logging the exception for later fixing, and IBM later released a patch for WAS that fixed the session cleanup code to continue even if sessionDestroyed threw an exception.<p>So, I very quickly solved this problem and waited for my $5000 spot bonus. And waited. And waited...<p>I went back to the manager and asked him about it. Over the next few weeks, he proceeded to tell me the following series of stories:<p>* It was in the works, and I&#x27;d have it soon.<p>* He had to get approval from his superiors.<p>* Because so many people had worked on the problem, it was decided that it should be split among the group, and that I&#x27;d have to share it with the people that couldn&#x27;t fix it.<p>* No bonus.<p>So even though it was his idea to try to bribe me to fix a problem, they still failed to follow through on it.<p>Another story: We had an issue once where they finally brought me in after a year of problems. One of our Java systems was failing intermittently, and the development team had given up and couldn&#x27;t figure out what was wrong. The boss told me it was now my problem, that I was to dedicate myself 100% of the time to solving the problem, and I could rewrite as much as much of the system as needed, basically total freedom (and responsibility). About halfway through the spiel where they were talking about the architecture and implementation, someone mentioned that the system was dumping core. I immediately stopped them right there.<p>Me: You realize that if it&#x27;s a coredump, it&#x27;s not our fault, right?
Boss: Huh?<p>Me: If a Java program coredumps, it&#x27;s either a bug in a 3rd party JNI library, a bug in the JVM, or a bug in the OS. What did the coredump show?
Boss: Wha?<p>Me: You guys have had this problem for a year and haven&#x27;t looked at the coredumps?
Boss: Blurgh?<p>So I fire up dbx and take a look at the last few coredumps. Pretty much instantly I can see the problem is in a JDBC type 2 (JNI native code) driver for DB2. We contact IBM, and after a bunch of hemming and hawing they admit there&#x27;s a problem that&#x27;s fixed in the latest driver patch. We upgrade the driver and poof! the problem is gone.<p>We had a year of failures, causing problems for customers, as well as all the wasted man hours trying to fix something in our code that simply could not have been fixed that way, all because the main dev team for this product had no idea how to debug it. I had an answer within 30 minutes of being brought in to the problem, and the solution was deployed within days.