Skip to content
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

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

Closed
arjantop opened this issue Apr 13, 2014 · 0 comments
Closed

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

arjantop opened this issue Apr 13, 2014 · 0 comments
Labels
A-concurrency Area: Concurrency related issues.

Comments

@arjantop
Copy link
Contributor

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
alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 14, 2014
During selection, libnative would erroneously re-acquire ownership of a task
when a separate thread still had ownership of the task. The loop in select()
was rewritten to acknowledge this race and instead block waiting to re-acquire
ownership rather than plowing through.

Closes rust-lang#13494
Dylan-DPC pushed a commit to Dylan-DPC/rust that referenced this issue Nov 1, 2022
feat: type inference for generic associated types

This PR implements type inference for generic associated types. Basically, this PR lowers generic arguments for associated types in valid places and creates `Substitution`s for them.

I focused on the inference for correct Rust programs, so there are cases where we *accidentally* manage to infer things that are actually invalid (which would then be reported by flycheck so I deem them non-fatal). See the following tests and FIXME notes on them: `gats_with_dyn`, `gats_with_impl_trait`.

The added tests are rather arbitrary. Let me know if there are cases I'm missing or I should add.

Closes rust-lang#9673
Dylan-DPC pushed a commit to Dylan-DPC/rust that referenced this issue Nov 1, 2022
Clean up tests and add documentation for GATs related stuff

This is a follow-up PR for rust-lang#13494.

- addresses rust-lang/rust-analyzer#13494 (comment)
- documents the ordering constraint on `Binders` and `Substitution` (which is not really follow-up for the previous PR, but it was introduced to support GATs and I strongly feel it's worth it)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-concurrency Area: Concurrency related issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants