Skip to content

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

Closed
@ttaubert

Description

@ttaubert

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().

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