-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to obtain V1 UUID once limit of 3fff is reached #32
Comments
Sorry - should read: unable to obtain UUID too fast once limit is reached. You can still obtain UUIDs if requesting slowly enough. Maybe that's why nobody ever encountered this. |
If resetting every time is taboo it could be done on roll-over only:
|
Investigating this a bit, originally the clock sequence would be reset to However, quoting RFC 4122 which explains the purpose of the "clock sequence",
Its purpose is not to be incremented whenever a UUID collision occurs but rather to ensure that UUID sequences don't overlap between system restarts (due to the system clock possibly being subject to some restart-induced offset). In this context, what the code currently does seems a bit questionable. That being said; it's very unlikely to run into such UUID collisions unless the resolution of the system clock is lower than the frequency by which UUID are requested; and I wasn't able to get even near such collisions on a non-virtualized Linux system. In this context another section of RFC 4122 is relevant:
So if there really are systems whose system clock resolution is too coarse you'd run into uuid exhaustion, I'd implement the suggestion mentioned above on how to simulate high-res timestamps. Moreover, I plan to provide a way to explicitly query/set the global clock-sequence value in order to allow API consumers to implement the system-restart semantics as described in 4.1.5. for those rare use-cases where this is actually needed. |
The source of version 1.3.13 says
Since
c0
is never reset to 0 it seems that once 3fff is reached - i.e. after requesting a V1 UUID too fast 3fff times - no new V1 UUID will ever be returned.Maybe the first
return
line should read (note the0
instead ofc0
)Or is there a reason for this behaviour, e.g. some specification that demands this?
The text was updated successfully, but these errors were encountered: