4 ms·
That's an implementation detail. What's the user-facing behavior? What should happen with mistakenly-accepted connections? Even the blog admits that cancellati
by whytevuhuni 2y ago
That's an implementation detail. What's the user-facing behavior? What should happen with mistakenly-accepted connections?
Even the blog admits that cancellation of any kind, is racing with the kernel which might complete the accept request anyway. Even if you call `.cancel()`, the queue might have an accepted connection FD in it. Even if it doesn't, it might do by the time the kernel acknowledges the cancellation.
So you now have a mistakenly-accepted connection. What do you do with it? Drop it? That seems like the wrong answer, whoever writes a loop like the one in the blog will definitely not expect some of the connections mysteriously being dropped.
- whytevuhuni 2y agoOkay, looks like withoutboats gave the answer to this in another thread [1], and that seems like the right answer. The accept() future being dropped must not result in any cancellation of any kind, unless the listener itself is also dropped. This is an implementation issue with monoio that just needs more polishing. And given how hard io_uring is to get right, monoio should be given that time before being chosen to be used in production for anything. [1] https://news.ycombinator.com/item?id=41994308 https://news.ycombinator.com/item?id=41994308
- ethegwo 2y agoI don't think the operation that completes after cancellation failed is "mistakenly-accepted," it should be handled in the normal way, but I admit that there are lots of people don't agree that