-
I'm using the direct variant of multishot accept, limiting the ring to only 10 file descriptors by only registering a sparse set of 10 files. However, I've noticed that in my unit test, if I want to accept more than 10 connections, I'm also using So basically, I have a hash set of entries 0 through But the problem seems to be that accept() walks the sparse table up to its length and then starts returning Am I missing a call to I'll try partitioning and seeing if that helps! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I write a small reproducer, but seems to work fine for me. See below paste. It sets up NFILES sparse descriptors, and uses multishot accept to get connections. When we hit NFILES of connections, we randomly close one of the previous ones. Run this for 4 * NFILES, works for me. You neglected to mention what kernel you are running, just in case this is a kernel issue. Code:
|
Beta Was this translation helpful? Give feedback.
-
I suspect you just want the ranges split, though, as you mentioned. Leave one range for direct allocations, one for ranges you pick. |
Beta Was this translation helpful? Give feedback.
-
Huh, you know what I just realized? I was closing the file descriptor incorrectly lol. auto ring = detail::executor_access_policy::ring( ex_ );
auto sqe = io_uring_get_sqe( ring );
io_uring_prep_close_direct( sqe, fd_ );
io_uring_sqe_set_flags(
sqe, IOSQE_CQE_SKIP_SUCCESS /* | IOSQE_FIXED_FILE */ );
io_uring_sqe_set_data( sqe, nullptr );
io_uring_submit( ring ); Namely, if you use Interestingly enough, if you do set that flag erroneously, you can then "fix" it by manually invoking Ha, now everything is working perfectly. Thank you for taking the time, Jens, I really appreciate it. Doing this much io_uring inspires me to help flesh out the man pages so hopefully in the future other users aren't as confused as me. |
Beta Was this translation helpful? Give feedback.
I write a small reproducer, but seems to work fine for me. See below paste. It sets up NFILES sparse descriptors, and uses multishot accept to get connections. When we hit NFILES of connections, we randomly close one of the previous ones. Run this for 4 * NFILES, works for me.
You neglected to mention what kernel you are running, just in case this is a kernel issue.
Code: