-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Description
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
doneI believe the issue is in this unsafe code:
lunatic/crates/lunatic-registry-api/src/lib.rs
Lines 177 to 182 in 07454fb
| // 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels