Skip to content

oneshot timer fails in select! if timeout is large value or 0 #13494

Closed
@arjantop

Description

@arjantop

Error occured when updating ~3 days old master to the current one (needed change was try_recv returning IoError instead of Option)

Code sample:

use std::io::timer::Timer;

fn main() {
    let (snd, rcv) = channel();
    let mut timer = Timer::new().unwrap();
    let mut t1 = timer.oneshot(1000);
    let x = std::u64::MAX;
    for _ in range(1, 1000000) {
        snd.send(1);
        t1 = timer.oneshot(x);
        select! {
            () = t1.recv() => (),
            _ = rcv.recv() => ()
        }
    }
}

Backtrace:

task '<main>' failed at 'internal error: entered unreachable code', /home/arjan/build/rust/src/libstd/comm/oneshot.rs:195
task '<unnamed>' failed at 'no timer found', /home/arjan/build/rust/src/libstd/option.rs:245
task '<main>' failed at 'receiving on a closed channel', /home/arjan/build/rust/src/libstd/comm/mod.rs:679
task failed during unwinding (double-failure - total drag!)
rust must abort now. so sorry.
stack backtrace:
   1:           0x506190 - rt::backtrace::imp::write::h73000e923db8f8b7zIa::v0.11.pre
   2:           0x4683a0 - rt::unwind::begin_unwind_inner::hd5e278f04045627f2ia::v0.11.pre
   3:           0x438120 - rt::unwind::begin_unwind::hd907aafc78f636c24Ld::v0.11.pre
   4:           0x457520 - io::timer::Timer::inner::h0a70eb6f5e1a2531Zsc::v0.11.pre
   5:           0x461f90 - io..timer..Timer::glue_drop.7720::h894cf2e205310099
   6:           0x462050 - _$UP$io..timer..Timer::glue_drop.7725::h3d066df014775776
   7:           0x4174f0 - _$UP$std..rt..rtio..RtioTimer.Send::glue_drop.2952::h79d93b82405080df
   8:           0x4174c0 - std..io..timer..Timer::glue_drop.2948::hf65e5830b565d04a
   9:           0x404290 - main::hb5066cf39873496bgaa::v0.0
  10:           0x467200 - start::closure.7981
  11:           0x5011b0 - rt::task::Task::run::closure.39999
  12:           0x50c720 - rust_try
  13:           0x500ff0 - rt::task::Task::run::hfe2b403bbc3fde7ao97::v0.11.pre
  14:           0x466e50 - start::h39e875edd9895d1bOqd::v0.11.pre
  15:           0x466dd0 - lang_start::h3d8e3d26bbbf553d8pd::v0.11.pre
  16:           0x404810 - main
  17:     0x7f7574992a10 - __libc_start_main
  18:           0x4041a0 - <unknown>
  19:                0x0 - <unknown>
[1]    13262 illegal hardware instruction (core dumped)  ./timers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions