logoalt Hacker News

mittermayrtoday at 8:20 AM3 repliesview on HN

I fully agree. It makes no sense. Yet...

The only guesses I'm having is that we originally generated UUIDv4s on a user's phone before sending it to the database, and the UUID generated this morning that collided was created on an Ubuntu server.

I don't fully know how UUIDv4s are generated and what (if anything) about the machine it's being generated on is part of the algorithm, but that's really the only change I can think of, that it used to generated on-device by users, and for many months now, has moved to being generated on server.


Replies

AntiUSAbahtoday at 9:38 AM

You let users generate a UUID?

To be honest, the chance that you are doing something weird is probably higher than you experiencing a real UUID conflict.

How did your database 'flag' that conflict?

show 1 reply
stubishtoday at 8:46 AM

The UUIDv4 collision is statistically extremely unlikely. What is more likely is both systems used the same seed. This might be just a handful of bytes, increasing the chance of collision to one in billions or even millions.

lazyjonestoday at 10:40 AM

Better check what crypto.js is actually doing in your exact setup. Weak polyfills exist...