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

fix(madsim): fix determinism for getrandom #202

Merged
merged 3 commits into from
Apr 7, 2024
Merged

Conversation

wangrunji0408
Copy link
Member

@wangrunji0408 wangrunji0408 commented Apr 7, 2024

This PR fixes #201, a bug happening on Linux only. The reason why getrandom yields a different value in the first run is that, a getrandom(0, 0) is called on first access to check the availability of this function (code). It mutates the global random state by mistake. This PR adds a branch to avoid the mutation.

release as madsim v0.2.27

Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
@wangrunji0408 wangrunji0408 enabled auto-merge (squash) April 7, 2024 08:02
@wangrunji0408 wangrunji0408 merged commit e9aa251 into main Apr 7, 2024
24 checks passed
@wangrunji0408 wangrunji0408 deleted the wrj/fix-rand branch April 7, 2024 08:23
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.

Creating multiple runtimes with the same seed yields different random values
1 participant