Open faern opened 2 years ago
I've also hit this, though I didn't have the time to put together a minimal reproduction --- thanks for that!
@hawkw I also encountered this issue, but my minimal reproduction example is fairly minimal:
use loom::thread;
#[test]
fn loom_panic() {
loom::model(|| {
let main = thread::current();
let other = thread::spawn(move || main.unpark());
// thread::park();
other.join().unwrap();
})
}
Seems that loom cannot handle unparking if there is no parking, because uncommenting thread::park();
makes loom happy.
I'm trying to add
loom
testing into my cratetriggered
. A simple test gives me errors I can't debug.Test code:
This test and a very slimmed down version of the library is available here: https://github.com/faern/triggered/blob/debug-loom-issue/src/lib.rs. Makes it easier to read both the test and the code it tests in a single file.
Results:
Inserting a
thread::yield_now()
call in some places makes the test succeed. Also, not caring about joining the thread also makes the test succeed. Both of these things makes me think the bug is inloom
, not my library. Since if my library had a bug,loom
should be able to find it even with those changes.Expected results:
yield_now
should not affect the test results.Related
Possibly related to #177? I don't think I have non-determinism here? At least not in a similar way as described in that issue. But the panic seems to be in a similar place.