-
Notifications
You must be signed in to change notification settings - Fork 284
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
maintenance: avoid deprecated bindings in uuidm 0.9.9 #6045
Conversation
@@ -52,7 +52,7 @@ let inventory = Hashtbl.create 10 | |||
|
|||
let inventory_m = Mutex.create () | |||
|
|||
let new_uuid = Uuidm.v4_gen (Random.get_state ()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not safe for OCaml 5 (in fact I think Uuidm's own documentation is wrong here, and hasn't been updated for OCaml 5). Sharing a State.t between domains is a bad idea.
Although this change doesn't introduce any new problems, because we've already had this problem before, we just didn't see it because it was hidden inside Uuidm.
(in fact strictly speaking Uuidm was only thread-safe previously if you ever called Uuidm on the main thread once to force the lazy value, because we know that on OCaml 4 forcing lazy values from multiple threads can lead to a segfault).
Lets revisit this when we switch to OCaml 5, we can then use Random.split ()
here, and be careful to avoid partial application).
Or we could use Uuid.make_uuid_fast
which solved all these problems already and has added a mutex to make this work on both OCaml 4 and 5.
(if you're guessing how I knew about these problems, it is because I've recently looked at how all this works when making changs to our uuidx module).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't appear to introduce any new bugs though (the domain-safety issue was also there with the old code).
Signed-off-by: Pau Ruiz Safont <[email protected]>
Signed-off-by: Pau Ruiz Safont <[email protected]>
Unblocks the CI on all open PRs