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

libuv/timer - 'Assertion loop_refs == 1i32 failed' when uv_loop exits #4191

Closed
ttaubert opened this issue Dec 14, 2012 · 7 comments
Closed
Labels
A-concurrency Area: Concurrency

Comments

@ttaubert
Copy link
Contributor

I'm spawning a weak thread that periodically sends messages to a specific channel. While that works, every time I exit the program - e.g. at test suite shut down - there is an assertion:

rust: task failed at 'Assertion loop_refs == 1i32 failed', /home/tim/workspace/rust-trunk/src/libstd/uv_iotask.rs:172
main: /home/tim/workspace/rust-trunk/src/rt/rust_upcall.cpp:81: void upcall_call_shim_on_rust_stack(void*, void*): Assertion `false && "Rust task failed after reentering the Rust stack"' failed.

It's quite easy to reproduce with a test like this:

fn test_foo() {
  let iotask = std::uv_iotask::spawn_iotask(task::task());
  let port = Port::<()>();
  let chan = port.chan();

  do task::spawn() {
    loop {
      chan.send(());
      std::timer::sleep(iotask, 0);
    }
  }

  port.recv();
  std::uv_iotask::exit(iotask);
}

The test reproduces it without the need to exit the program. Just append another long sleep call at the end of it. The same thing happens when using delayed_send().

@ttaubert
Copy link
Contributor Author

CC'ing @olsonjeffery because he seems to be the author of most of the libuv code.

@ILyoan
Copy link
Contributor

ILyoan commented Apr 29, 2013

This is still relevant, reproduced by this code.

fn test_foo() {
  let iotask1 = std::uv_iotask::spawn_iotask(task::task());
  let iotask2 = iotask1.clone();
  let (port, chan) = comm::stream();

  do task::spawn() {
    loop {
      chan.send(());
      std::timer::sleep(&iotask2, 0);
    }
  }

  port.recv();
  std::uv_iotask::exit(&iotask1);
}

@graydon
Copy link
Contributor

graydon commented Apr 30, 2013

assigning bug; change assignment if you disagree

@ghost ghost assigned brson Apr 30, 2013
@Blei
Copy link
Contributor

Blei commented Jun 13, 2013

Complete updated test:

extern mod extra;

fn test_foo() {
  let iotask1 = extra::uv_iotask::spawn_iotask(std::task::task());
  let iotask2 = iotask1.clone();
  let (port, chan) = std::comm::stream();

  do std::task::spawn() {
    loop {
      chan.send(());
      extra::timer::sleep(&iotask2, 0);
    }
  }

  port.recv();
  extra::uv_iotask::exit(&iotask1);
}

fn main() {
    test_foo();
}

This fails with:

rust: task failed at 'left: 140597564275144 does not equal right: 140597585244248', /home/philipp/programming/rust/src/libextra/uv_iotask.rs:191
foo: /home/philipp/programming/rust/src/rt/rust_upcall.cpp:98: void upcall_call_shim_on_rust_stack(void*, void*): Assertion `false && "Rust task failed after reentering the Rust stack"' failed.

@brson
Copy link
Contributor

brson commented Jun 20, 2013

I am not currently maintaining the networking code in libextra. This won't be fixed in 0.7.

@huonw
Copy link
Member

huonw commented Aug 5, 2013

Triage 2013-08-05: Seems like this is no longer relevant since extra::uv has been removed, and libuv is integrated much deeper into the new runtime so (1) I have no idea how to write something that might reproduce this, and (2) it is unlikely this applies to newrt.

Could someone how knows what they are talking about (@bblum, @brson, @toddaaro) close this?

@toddaaro
Copy link
Contributor

@huonw yea, that sounds right. I'll mark this closed as old network code has been replaced by newrt functionality. If this is some weird case where the bug persists someone can re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-concurrency Area: Concurrency
Projects
None yet
Development

No branches or pull requests

7 participants