-
Notifications
You must be signed in to change notification settings - Fork 80
UUID.generate collisions when called too often #21
Comments
Backward clock happens when the system clock is adjusted backwards which is not likely to happen often enough for you to notice. That detection is done in |
So it sounds like my guess for why the dupes occur is in error. However, it does dupe fairly often even though I use this synchronized version everywhere. Aside from "don't call it so often" is there a fix or should I work around it? Sent from my iPhone On Jan 7, 2012, at 3:32 PM, Assaf [email protected] wrote:
|
Frequency is not the issue, it either works or doesn't. I assume you're calling |
I am calling UUID.generate (based on our last conversation). It isn't working because I sometimes get duplicates. What do you suggest? cr On Jan 7, 2012, at 4:18 PM, Assaf Arkin wrote:
|
My best guess is that the mutex is not working under that version of JRuby. |
Under JRuby I am calling UUID.generate quite often. I see a case in my logs where two successive calls returns the same UUID. Looking at the code, I see this comment:
Judging by the comment, I assume that it is possible that a backward clock could be detected twice in a row, so asking for a new sequence number in that situation will still generate the same UUID when UUID.state_file=nil. If this assumption is correct, would it be reasonable to randomize the next sequence number?
e.g.
If that is acceptable, I could provide a patch.
The text was updated successfully, but these errors were encountered: