TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Very reliable uuid1 collisions in Python 2.7.3?

2 pointsby CptCodeMonkeyalmost 12 years ago
Since friday I&#x27;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.<p>I wrote a test script here https:&#x2F;&#x2F;gist.github.com&#x2F;devdave&#x2F;5892749 that always fails in .05 to .09ths of a second.<p>I originally discovered this was happening when testing out cqlengine ( an ORM like interface to cassandra for python ) and opened an issue ticket. Here&#x27;s the issue ticket - https:&#x2F;&#x2F;github.com&#x2F;cqlengine&#x2F;cqlengine&#x2F;issues&#x2F;82<p>I&#x27;ve gone down the line, isolating the issue to the gist, trying a pristine Ubuntu 12.04 instance, and still gotten the same results.<p>The source code for uuid1 in Python 2.7.3 is mirrored here https:&#x2F;&#x2F;github.com&#x2F;certik&#x2F;python-2.7&#x2F;blob&#x2F;master&#x2F;Lib&#x2F;uuid.py#L490<p>And I discovered after setting https:&#x2F;&#x2F;github.com&#x2F;certik&#x2F;python-2.7&#x2F;blob&#x2F;master&#x2F;Lib&#x2F;uuid.py#L500 `_uuid_generate_time` to None the collisions went away suggesting theres a problem in libuuid or more likely how Virtualbox implements &#x2F;dev&#x2F;random<p>Still this seems like a somewhat major gotcha that someone else should have at least run into before... right?<p>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) =&gt; &#x2F;lib&#x2F;i386-linux-gnu&#x2F;libuuid.so.1<p>Currently upgrading virtualbox to see if its a VM implementation issue thats been resolved.

no comments

no comments