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

Timer periodic method can cause a weird failure #10375

Closed
mstewartgallus opened this issue Nov 9, 2013 · 1 comment
Closed

Timer periodic method can cause a weird failure #10375

mstewartgallus opened this issue Nov 9, 2013 · 1 comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

Comments

@mstewartgallus
Copy link
Contributor

The following code sometimes causes a weird failure on exit. The error:


You've met with a terrible fate, haven't you?

fatal runtime error: type error: used SchedTask as GreenTask
aborted

The code:

use std::rt::io::timer::Timer;
use std::task;

pub fn main() {
    let mut timer = Timer::new().expect("Expected a timer");
    let timer_port = timer.periodic(1000);

    do {
        let mut task = task::task();
        task.name("Timer Port Listener");
        task
    }.spawn_with(timer_port) |timer_port| {
        loop {
            timer_port.try_recv();
        }
    }
}
@alexcrichton
Copy link
Member

I've fixed this in my uv-rewrite branch. In my rewrite you also get a much clearer error (so we'll know exactly when this happens). This is actually a cause of a race condition as implemented today, but has a terrible error.

alexcrichton added a commit that referenced this issue Nov 9, 2013
When a channel is destroyed, it may attempt scheduler operations which could
move a task off of it's I/O scheduler. This is obviously a bad interaction, and
some finesse is required to make it work (making destructors run at the right
time).

Closes #10375
flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 10, 2023
Do not suggest using Self in const generic parameters

Fixes rust-lang#10371

changelog: FP: [`use_self`]: do not suggest using `Self` in const generic parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Projects
None yet
Development

No branches or pull requests

2 participants