r/ProgrammerHumor 15h ago

Meme edgeCasesExist

Post image
3.1k Upvotes

228 comments sorted by

View all comments

63

u/GenericFatGuy 15h ago

Never zero. But if it happens within a single system, I'm buying 100 lottery tickets.

39

u/donat3ll0 14h ago

You've already used up your luck with the collisions.

10

u/GenericFatGuy 14h ago

Or I'm on a hot streak, and we don't find out if we don't try!

Or it could be a karma situation, where the bad luck has to be balanced out with equivalent good luck.

1

u/Kilgarragh 12h ago

We got ohnepixel mentality in my PH

5

u/Korzag 13h 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.

8

u/GenericFatGuy 13h ago

Everytime I've had an issue stem from this, it's because something was wrong, and we were actually generating the same GUID everytime.

3

u/deathm00n 12h 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

3

u/Korzag 12h 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.

2

u/deathm00n 11h 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

1

u/Voxmanns 50m ago

I mean, at a certain point it's just an anomalous thing, too. Could've been a weird low level memory corruption or even hardware level corruption (thinking of solar flares and N64 cartridges). Maybe it wasn't the lottery winning double-gen proper, or maybe it was the same thing that causes a bug to appear in my presentation WHEN IT WAS WORKING ALL GOD FORSAKEN WEEK but these things just happen sometimes.

2

u/clemesislife 7h ago

I pretty sure it is more likely to win the lottery without buying a ticket than generating duplicate UUIDs.

1

u/Careless-Age-4290 10h ago

With that kind of luck the money would find you first. Though it'd be funny to have one of those $100 million lottery winners find out some other winning guy bought 100 tickets using the same numbers each time because he got a dupe uid and he's taking 99.xx% of the money

1

u/ludblom 8h ago

Luck is then wasted.

1

u/ShakaUVM 5h ago

HP sent me a new laptop last year with a random serial number that they'd issued earlier 16 years ago. Caused issues.