Here’s something I think everyone can relate to: you fix a problem, only to discover later on that it’s still happening. Why is that? Sometimes we’re in a rush, or are a little careless. I believe it’s often because we did not understand the problem well enough to actually address it. By being a little more deliberate we can avoid this, and reliably fix problems once and for all. And it’s not a particularly technical skill. We need to start by asking “why” more, and looking for the answers to understand the problem well enough to confidently solve it.
The case of the OutOfMemoryErrors
At HubSpot one of the things I’m responsible for is a web crawler. This system has had a multitude of issues but one class of them, OutOfMemoryErrors, have been perennial. At times it seemed there was another every other week. They no longer plague me, and I attribute that to continually questioning why the error was occurring and searching for the answers before fixing it.
An example from earlier this year started like most others: with a heap dump.
Had I just added more memory to the service, this issue would have been buried for longer. It would have consumed more resources, which cost us. Other users of the headless browser client would be inadvertently downloading images as well. Best of all, I don’t get OutOfMemoryErrors any longer.
A habit of asking “why”
At each step of the way I was able to find some concrete evidence that led me to the next step. Often the code itself is not enough to correctly discover an issue so these artifacts are incredibly important. Things like heap dumps, thread dumps, and log files can give us a picture of the system as it runs. They also typically have timestamps included so it is possible to collate the evidence to construct a more complete picture of what happened.
By cultivating a habit of asking “why” and searching for evidence, we can solve problems rather than treating symptoms. I say “habit” because it’s a practice that we add to our work rather than a specific skill. You may find that it takes a while to become successful at it, but like many things, the more repetition, the easier it will become, until you find it’s happening automatically for you.