In well-typed/blockio-uring#58 we appear to observe the following behaviour:
- thread submits IO to the ring
- the thread exits
- the IO completes
- 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.
In well-typed/blockio-uring#58 we appear to observe the following behaviour:
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.