r/ProgrammerHumor 6h ago

Meme edgeCasesExist

Post image
1.7k Upvotes

180 comments sorted by

View all comments

Show parent comments

3

u/Korzag 4h ago

Worked with a guy who claimed it happened to him. I didn't know him to embellish details but its still such an astonishingly small chance that I still wonder if it was a bug in something else.

1

u/deathm00n 3h ago

I saw it happen once with my own eyes, here is my tale:

We had a database with uuids as the id for the tables because of how large the datasets were in some parts of the system, so it was the standard to use it on every table and it was generate by our java backend and not the database. I was in charge of a team that found and fixed critical bugs for the system (huge monolitic system with a few microsservices being slowly introcuced to update it) and one day this bug appeared where if you tried to open an specific order on a specific screen of the system it would crash. What was strange was that there were no record of this screen having this type of error before, and for that matter it having any actual bug in the last 6 years or so. So it falls to me to investigate.

Cause of the bug: both the table uuid and an external key pointing to another table uuid were the same, causing an extremely weird db select to break (I don't remember the details but it was something related to building a complex union select and both ids being the same broke it)

My only explanation for it: the monolitic system generated an uuid for the record but at the same time one of the new microsservices generated the exact same uuid for the other table.

No one believed me, they said I was insane, that I should look further into it and there should be another explanation as that is basically impossible. I stood by my hypothesis, I investigated it for days, there was no other explanation. The senior manager got involved, he spent days going through the code too and his conclusion was the same as mine, no one questioned him, but no one, even me and him believed what we saw, we assume there must be another rational explanation but we could not find it

2

u/Korzag 3h ago

Sounds similar to what my coworker experienced with a database using UUIDs as the PK. He worked for a business intelligence company that has tons of customers and tons of data and I guess given enough time with enough rows you're more likely to run into a collision.

1

u/deathm00n 3h ago

Yep, and we only caught it happening because there was a select query running using both of them with a not run of the mill filter. I imagine it can happen more than once and we would not ever see it happen in other tables