This is what the dev team at Mashape (Mike and Marco) learnt from their bad experience, with an happy ending.
One day, we were taking a break after a hard-core coding session, drinking their daily cup of tea:
Mashaper Mike with his tea
We were swaggering on our perfect code base. The asyncronous jobs were working good, the thread pool was implemented perfectly, everything was perfect. We started thinking that we deserved a trip to Hawaii, where we would spend all our money laughing, joking, and drinking. BOOM! Suddenly our Java unit tests exploded.
Noooo! The bug ruined our dreams! :(
We started looking for the bug that ruined our dreams
Seconds, minutes, hours passed… we were tired, hungry, and thirsty. Mike was looking old, and I started ranting that the tea got cold. We were alone, in the dark, at 2am, with that bug. After a long time, Mike saw the promised land above the breakpoint, while I started imagining seeing pretty ladies coming in the room during our debug session. You know, the promised land it’s ok, but when you see nice girls around you while debugging, there’s clearly something that’s going wrong. We took a deep breathe of fresh air, and some beers.
We looked at each other, perplexed, and in a couple of minutes we were back again on the desk.
After some heavy, boring, challenging debugging sessions, and some beers, we looked carefully at the locks on shared variables between threads… and we finally found it!
I started crying. Mike saw the Holy Grail above the toolbar, we were super excited
It felt just like how you passed that unpassable exam at school, or when you win the lottery.
Just like this:
Both of us..
We fixed the bug and, ta-dah! Our asyncronous jobs were working again!
Conclusion: Never drink hot tea during a debug session, because it gets cold after a while.