Ask HN: Very reliable uuid1 collisions in Python 2.7.3?
Since friday I've been arguing with a project owner about the use of uuid1 in their project as I can rapidly and reliably cause uuid1 collisions in a single process in under 1 second of testing.
I wrote a test script here https://gist.github.com/devdave/5892749 that always fails in .05 to .09ths of a second.
I originally discovered this was happening when testing out cqlengine ( an ORM like interface to cassandra for python ) and opened an issue ticket. Here's the issue ticket - https://github.com/cqlengine/cqlengine/issues/82
I've gone down the line, isolating the issue to the gist, trying a pristine Ubuntu 12.04 instance, and still gotten the same results.
The source code for uuid1 in Python 2.7.3 is mirrored here https://github.com/certik/python-2.7/blob/master/Lib/uuid.py#L490
And I discovered after setting https://github.com/certik/python-2.7/blob/master/Lib/uuid.py#L500 `_uuid_generate_time` to None the collisions went away suggesting theres a problem in libuuid or more likely how Virtualbox implements /dev/random
Still this seems like a somewhat major gotcha that someone else should have at least run into before... right?
My dev stack: Virtualbox 4.2.10 r84104 Precise 32bit Ubuntu 12.04 LTS Python 2.7.3 #ldconfig -p | grep libuuid libuuid.so.1 (libc6) => /lib/i386-linux-gnu/libuuid.so.1
Currently upgrading virtualbox to see if its a VM implementation issue thats been resolved.
No comments yet.