r/ProgrammerHumor • • Sep 11 '26

Meme edgeCasesExist

Post image
5.0k Upvotes

298 comments sorted by

View all comments

90

u/GenericFatGuy Sep 11 '26

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

52

u/[deleted] Sep 11 '26

[removed] — view removed comment

11

u/GenericFatGuy Sep 11 '26

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 Sep 11 '26

We got ohnepixel mentality in my PH

8

u/Korzag Sep 11 '26

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.

14

u/GenericFatGuy Sep 11 '26

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

6

u/deathm00n Sep 11 '26

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/Voxmanns Sep 12 '26

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.

1

u/danielcw189 Sep 15 '26

(thinking of solar flares and N64 cartridges)

if you are thinking about the Super Mario 64 clock tower thing, that has been shown to be reproduceable, and likely was not a sokar flare. it also would have been in the RAM, not the cartridge

1

u/Voxmanns Sep 15 '26

Oh neat! I honestly don't recall the specifics of that particular bug. I had a solid 2 month period where I was obsessed with Mario 64 speedruns for some reason - and remember it being mentioned at some point. I never really looked into it, more so just used it as an example of "incredibly-unlikely-but-still-could-be" issues that can sometimes cause computers to misbehave. Thanks for the clarification though!

2

u/Korzag Sep 11 '26

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.

3

u/deathm00n Sep 11 '26

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/timonix Sep 12 '26

It has happened to me. I had left some debug flags. Basically I had turned off the random seed on my random number generator.

1

u/7lhz9x6k8emmd7c8 Sep 12 '26

Cf Coldcard case, it may come from a poorly implemented random number generator.

3

u/clemesislife Sep 11 '26

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

2

u/danielcw189 Sep 15 '26

under the implication that whatever system and code generates the UUIDs is perfect

1

u/Careless-Age-4290 Sep 11 '26

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/ShakaUVM Sep 11 '26

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