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

invalid memory reference (signal: 11) when using the new atomic registry API #189

Open
bkolobara opened this issue Feb 4, 2023 · 0 comments

Comments

@bkolobara
Copy link
Contributor

This is a bit of a hard to reproduce bug. You will need to run some tests from https://github.com/lunatic-solutions/lunatic-rs in a loop to trigger it:

while true; do 
    cargo test --test registry
done

I believe the issue is in this unsafe code:

// Extend the lifetime of the lock, so it can be saved across host calls.
// Safety:
// The process state (containing the lock) can't outlive the `RwLock`,
// which is global. This makes it safe to extend the lifetime.
let registry_lock: RwLockWriteGuard<'static, HashMap<String, (u64, u64)>> =
unsafe { transmute(registry_lock) };

One way to resolve this would be to move the "lookup and insert" operation to the process spawning function. In that case we would not require to hold onto a lock across host-guest-host calls.

@bkolobara bkolobara changed the title invalid memory reference (signal) when using the new atomic registry API invalid memory reference (signal: 11) when using the new atomic registry API Feb 4, 2023
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

No branches or pull requests

1 participant