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(beamr): prevent race condition in debug logging from C #108

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

oltarasenko
Copy link
Collaborator

A race condition in the C debug logging caused occasional segfaults during massive import tests. The issue arose from
concurrent execution of hb_driver.c functions and wasm_handle_import.

For example, drv_unlock would release a lock, while wasm_handle_import—running in parallel—could destroy it before drv_unlock completed its debug logging, leading to undefined behavior.

This fix ensures that the names of cond and mutex are copied before releasing the lock, allowing debug prints
to use the copied values safely.

A race condition in the C debug logging caused occasional
segfaults during massive import tests. The issue arose from
 concurrent execution of hb_driver.c functions and wasm_handle_import.

For example, drv_unlock would release a lock, while
wasm_handle_import—running in parallel—could destroy it before
drv_unlock completed its debug logging, leading to undefined behavior.

This fix ensures that the names of cond and mutex are copied before
releasing the lock, allowing debug prints
to use the copied values safely.
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.

2 participants