java 7 uuid bug?

Viewed 1528

I believe I may have found a UUID multi-threading bug in Oracle Java7 Update 5 and I was wondering if anyone could confirm with an independent example. Basically what happens is if I call UUID.Random() concurrently (I'm using 64 threads), I get a collision quickly most of the time).

However, If the UUID generator is warmed up by running a test beforehand that just tosses a bunch of UUIDs it seems to work fine. Here's a gist in scala:

https://gist.github.com/3318973

Important to note that I'm inserting into a mutable Set that I'm synchronizing from 64 different threads. The main thread blocks waiting for the workers to finish and then checks that the set size is what it should be. Collisions are printed as they occur.

thanks! Adam

2 Answers
Related