The Real Cause · Debug Season · Pulse Beat
He found the second bug on the ninth night of reading. It was in a place he had not suspected: the little cache that remembered which device had last synced. A key built from two numbers glued…
He found the second bug on the ninth night of reading.
It was in a place he had not suspected: the little cache that remembered which device had last synced. A key built from two numbers glued together, a user's id and a device's id, with no separator. User 12, device 3 became "123". So did user 1, device 23.
He sat looking at it for a long time. It was the kind of bug that makes you want to leave the profession. The first one had been a stranger's assumption; this one was entirely his. A shortcut he had taken on his second weekend, when he thought no one would ever have enough users for it to matter.
He ran the numbers. Of the fifty-one accounts, three pairs collided. Nothing had leaked, by luck, because both users in each pair had never written within the same ten seconds. But they could have. Next month, with two hundred users, they would.
He wrote the fix in four lines. Then, because he was done being surprised, he wrote the test, the check, the alert that would shout if it ever happened again, and a longer note to himself: Every shortcut is a loan. Interest compounds.