The worst bug I’ve seen (in a while)

What is the worst bug you’ve ever encountered?

Day 1: And so it begins

The Cumul8 Dashboard Module
I was able to drag tiles on my local environment without any issues
“There it was. The bug!“ (It’s a bit hard to tell, but I’m trying to drag and bottom tile, but it is stuck and the browser is completely frozen after the drag start event was initialized)
The highlighted (blue) Cumul8 tab showing 101.8% CPU usage during the frozen state
“…as soon as I tried dragging tiles in the dev build — the issue disappeared.”
“… the list of mysteries was only getting longer”

Day 2: Now it’s personal!

“I started going through the Git commits of past releases looking for anything of value.”
“The dev tools paused the infinite loop and showed me exactly what code was currently being executed…”

Fast forward a few hours — it turned out to be a complete red herring. When pausing the debugger in the dev tools in the middle of an infinite loop, apparently variables will be shown as undefined in the dev tools. It doesn’t actually mean they’re undefined, just that the dev tools can’t show you their value. But I did waste a few hours trying to go down this path.

* Translate x and y coordinates.
* @param {Number} top Top position (relative to parent) in px
* @param {Number} left Left position (relative to parent) in px
* @return {Object} x and y in px.
calcXY (top, left) {
const {
} = this.props;
let x = left > 0 ? left : 0;
if (x + w > containerWidth) {
x = containerWidth - w;
while (x % (colWidth + margin[0]) !== 0) {
let y = top > 0 ? top : 0;
while (y % (rowHeight + margin[1]) !== 0) {
return { x, y };
“I put some console.log statements to print out the widths of my elements…”
“…I zoomed out via the browser’s zoom feature and all of a sudden something unexpected happened…”

The fix and the lessons



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store