Skip to content

Unnecessarily failing IO when the submitting thread exits before the IO completes #1595

Description

@dcoutts

In well-typed/blockio-uring#58 we appear to observe the following behaviour:

  1. thread submits IO to the ring
  2. the thread exits
  3. the IO completes
  4. the CQE is delivered with error -EFAULT

https://github.com/torvalds/linux/blob/master/io_uring/io_uring.c#L1058

That is, if the thread that submitted the IO exits before the IO completes, then the IO is reported as failing.

This would appear to be an unnecessary failure. The IO really did complete successfully, and the ring is still there and other threads are able to pick up the CQE. Why do we need to report the IO as failing? We're not explicitly cancelling the IO, indeed we do not want to cancel the IO.

This behaviour interacts poorly with application designs that use a pool of worker threads. In this application design only one thread animates the application at once (so there's no danger of concurrent use of the SQ or CQ), but the thread that animates the application can change relatively frequently (for reasons probably not worth elaborating here), and idle worker threads can get tidied up from time to time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions