Skip to content
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

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

psafont
Copy link
Member

@psafont psafont commented Oct 8, 2024

Unblocks the CI on all open PRs

@@ -52,7 +52,7 @@ let inventory = Hashtbl.create 10

let inventory_m = Mutex.create ()

let new_uuid = Uuidm.v4_gen (Random.get_state ())
Copy link
Contributor

@edwintorok edwintorok Oct 8, 2024

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).

Copy link
Contributor

@edwintorok edwintorok left a 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).

@psafont psafont enabled auto-merge October 8, 2024 14:51
@psafont psafont added this pull request to the merge queue Oct 8, 2024
Merged via the queue into xapi-project:master with commit d4c2be1 Oct 8, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants