-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add miri CI test #37
Add miri CI test #37
Conversation
Codecov Report
|
902776f
to
683a72c
Compare
@danielSanchezQ Interesting -- it looks like the tests from #36 found a memory leak. Want to take a stab at fixing them? The logs are here, and the relevant entries are:
Specifically, it looks like the value inserted here for Line 1695 in 9544337
and here for replace_existing_observed_value_matching Line 1707 in 9544337
are not freed when we later replace them. I'm not entirely sure why, but some prints may help clarify the situation? |
Sure, I’ll investigate the issue! |
This piece of code solves the memory leak: if let Some(nv) = new_value {
let dropable_old = n.value.load(Ordering::SeqCst, guard);
n.value.store(Owned::new(nv), Ordering::SeqCst);
// we are just replacing entry value and we do not want to remove the node
// so we stop iterating here
// force droping the old value
drop(unsafe {dropable_old.into_owned()});
break;
} I'm forcing the drop. Probably is not the best way, but it gives some hints. |
Ah, no, I see what's going on! The old_value = Some(ev); does not get executed, which in turn means that the deferred destroy further down does not get executed Line 1238 in 9544337
I think this would be fixed by moving Line 1187 in 9544337
up to just above the if. Will implement that! |
In fact, thinking some more on it, I think this assertion is wrong: Line 1697 in 9544337
It should be Some since we replaced an old value! The fix above also fixes that.
|
That worked 🎉 |
Aaaah, I see it now. Actually it was my fault there. I understood that since we are not really removing the entry nothing should be returned. But ofc it makes sense that the old value is returned. Sorry for that! |
These are probably spurious; see crossbeam-rs/crossbeam#464 and spacejam/sled#937 (comment) And besides, we're now running both the leak sanitizer and the address sanitizer.
Currently blocked on rust-lang/miri#1150 landing on nightly and on crossbeam-rs/crossbeam#458.