Skip to content

tokio panic with Error 0 inside rustup #192

@jgallagher

Description

@jgallagher

We've seen the following errors a few times in CI (omicron, propolis, omicron again):

thread 'main' panicked at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/io/driver.rs:208:27:
failed to wake I/O driver: Os { code: 0, kind: Uncategorized, message: "Error 0" }

As best I can tell (assuming no unsafe thread safety shenanigans, which is maybe not a good assumption), the only way this can happen is if libc::read or libc::write to an eventfd file descriptor returns -1 without setting errno.

tokio is unwrapping a call to Waker::wake(): https://github.com/tokio-rs/tokio/blob/5f3296df77ad594779d1fe1a1583078ca9832daf/tokio/src/runtime/io/driver.rs#L208

This lands in mio. A Waker is created via eventfd then wrapped in a std::fs::File: https://github.com/tokio-rs/mio/blob/f45f4928dabe8c22114e63b06c1e6177ef4eb192/src/sys/unix/waker/eventfd.rs#L38-L39.

wake() calls read first (but only on illumos) then write, but in both cases it only handles the io::Error it's given from the standard library, which AFAICT can only return the error we see above if we get back -1 but errno is 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions