rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
99.12k stars 12.8k forks source link

'assertion failed: list.len() == 0', /libnative/io/timer_timerfd.rs:166 #12684

Closed mvdnes closed 10 years ago

mvdnes commented 10 years ago

Error

task '<unnamed>' failed at 'assertion failed: list.len() == 0', /build/buildd/rust-nightly-201403040405~3c0d098~precise/src/libnative/io/timer_timerfd.rs:166
task '<unnamed>' failed at 'receiving on a closed channel', /build/buildd/rust-nightly-201403040405~3c0d098~precise/src/libstd/comm/mod.rs:507
task '<unnamed>' failed at 'sending on a closed channel', /build/buildd/rust-nightly-201403040405~3c0d098~precise/src/libstd/comm/mod.rs:368
task failed during unwinding (double-failure - total drag!)
rust must abort now. so sorry.
Illegal instruction (core dumped)

Version

Latest nightly (rust-nightly_201403040405~3c0d098~precise_amd64.deb) from http://ppa.launchpad.net/hansjorg/rust/:

s0828599@u0009747:~/playground/rboy/src$ rustc -v
rustc 0.10-pre
host: x86_64-unknown-linux-gnu
s0828599@u0009747:~/playground/rboy/src$ uname -a
Linux u0009747 3.5.0-46-generic #70~precise1-Ubuntu SMP Thu Jan 9 23:55:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Additional information

This error happens in my Gameboy color emulator https://github.com/mvdnes/rboy, after switching from the 'normal' starting and spawning. The problem started when I switched to spawning my thread with libnative. (Another stange thing, when starting main in native my SDL window would not quit.) I use timer::periodic to slow down the emulator. Given the error, I assume that is the place the error could lie.

pethin commented 10 years ago

Using timers with libnative on Linux is broken right now. #12689

thestinger commented 10 years ago

I doubt that #12689 is the cause of this problem. While using usleep is broken, it's won't cause a failure or memory safety issue (except in a contrived example). I think sleeping/timers needs to be redesigned rather than just patched up though.

pethin commented 10 years ago

@thestinger True. Timers do show strange behavior on libnative though.

alexcrichton commented 10 years ago

12689 is unrelated to this. I am unable to reproduce this with small test cases, and a large project is difficult to debug. Is it possible to minimize this assertion that you're seeing?

mvdnes commented 10 years ago

I was able to trigger the same error message in the following code:

extern crate native;

fn main() {
    native::task::spawn(proc() customtask());
}

fn customtask() {
    let mut timer = std::io::timer::Timer::new().unwrap();
    let periodic = timer.periodic(100);
    periodic.recv();
}
alexcrichton commented 10 years ago

Thanks! I'll investigate soon.