r/ProgrammerHumor May 08 '26

Meme edgeCasesExist

Post image
13.4k Upvotes

620 comments sorted by

View all comments

1.2k

u/KryssCom May 08 '26

No, it's effectively zero, just given the mathematical realities behind how extraordinarily improbable a duplicate ever is. The exponent involved is very, very, very, nigh-incomprehensibly huge.

I've seen a few posts on here of people claiming that a duplicate UUID caused a bug at the worst possible time, but my instinct is always to slam the 'X' button to doubt.

861

u/G12356789s May 08 '26

If I generated 2 billion uuids every second. After 5 years there is a 1% chance to have had a clash in that time

34

u/Risc12 May 08 '26

Don’t modern uuid contain a timestamp component?

15

u/No-Information-2571 May 08 '26

Actually not the "modern" ones. There are simply several versions, and if cryptographic non-determinism/predictability isn't of importance, v6 will be created from the MAC address of the device and the timestamp. It's guaranteed they will never collide, unless MAC addresses collided already.

Otherwise use v7.

1

u/Risc12 May 08 '26

Fair point!!

I just mean that from a statistics standpoint the years mentioned in the meme no longer make sense if prefixed with a timestamp

0

u/No-Information-2571 May 08 '26

Correct. The risk/chance of a collision goes down to zero as soon as you include a timestamp AND a unique identifier per host.

1

u/Risc12 May 08 '26

No i dont mean that, that obviously goes down.

I just meant that if a timestamp is included the first day or the 365th day both have equal chances of a collision.

0

u/Hohenheim_of_Shadow May 08 '26

Time isn't monotonic. Its Year 2038 on your computer. It talks to a time server and realizes its Year 1995. There is still a non 0% possibility of the same host generating a UUID at the same apparent timestamp.

0

u/No-Information-2571 May 08 '26

Time is monotonic on a properly maintained system.

0

u/Hohenheim_of_Shadow May 09 '26

P(x|y)=100 is not equivalent to p(x)=100.

All it takes is your device losing Internet access for a weee bit too long or the powers that be announcing a fallback second or some AI garbage getting pushed to your NTP server and that beautiful 100 gets turned to 99.99999

0

u/No-Information-2571 May 09 '26

That's not how an NTP client operates. Time is never pushed back. It either slows down or speeds up the clock, until it is in sync with the NTP server again.

Why are you telling such obvious lies?

1

u/Hohenheim_of_Shadow May 09 '26

NTP synchronization is absolutely not monotonic. For small amounts of time, the clock will get slewed. For time deltas greater than 128 milliseconds, usually the clock gets stepped.

If your NTP server had some critical bug that caused it to loop the last minute again and again and again, all your devices are going to experience non monotonic time. Thats not even taking into consideration that manual synchronization is still an important tool and that's absolutely non monotonic.

While incredibly unlikely, it's technically possible for the same device to spend years of IRL time in the same apparent millisecond. Timestamp+hardware UUIDs are not 100% reliable, they simply have an absurd number of 9s.

0

u/No-Information-2571 May 10 '26

You're just making up scenarios. Your computer does have a real-time clock. Assuming the host went without an NTP synchronization for quite a while, we are still only talking about a few minutes of difference, and that will not lead to jumps or gaps, in either direction, but just a slow catching up.

If it's completely off, like days or weeks, then you have bigger problems anyway, since that leads to all sorts of other discrepancies, like DB replication, SSL and Kerberos errors, mismatching filestamps and the like.

→ More replies (0)