public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: jrun <[email protected]>, io-uring <[email protected]>
Subject: Re: happy io_uring_prep_accept_direct() submissions go hiding!
Date: Thu, 9 Dec 2021 15:02:12 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <20211208190733.xazgugkuprosux6k@p51>

On 12/8/21 19:07, jrun wrote:
> hello,
> 
> - this may very well be something simple i'm missing so apologies in advance. -
> 
> _some_ calls to io_uring_prep_accept_direct() never make it back from
> kernel! or they seems so... since io_uring_prep_accept_direct() is a new
> introduction to io_uring i thought i check with you first and get some help if
> possible.

Don't see how a CQE may get missing, so let me ask a bunch of questions:

First, let's try out my understanding of your problem. At the beginning you
submit MAX_CONNECTIONS/2 accept requests and _all_ of them complete. In the main
loop you add another bunch of accepts, but you're not getting CQEs from them.
Right?

1) Anything in dmesg? Please when it got stuck (or what the symptoms are),
don't kill it but wait for 3 minutes and check dmesg again.

Or you to reduce the waiting time:
"echo 10 > /proc/sys/kernel/hung_task_timeout_secs"

And then should if anything wrong it should appear in dmesg max in 20-30 secs

2) What kernel version are you running?

3) Have you tried normal accept (non-direct)?

4) Can try increase the max number io-wq workers exceeds the max number
of inflight requests? Increase RLIMIT_NPROC, E.g. set it to
RLIMIT_NPROC = nr_threads + max inflight requests.

5) Do you get CQEs when you shutdown listening sockets?

6) Do you check return values of io_uring_submit()?

7) Any variability during execution? E.g. a different number of
sockets get accepted.


> ---------
> TEST_PROG:
> ---------
> 
> this msg has a git repo bundled which has the crap i've put together where i
> encounter this. to compile/run it do this, save the bundle somewhere, say under
> `/tmp/` and then do:
> 
> ```
> cd /tmp/
> git clone wsub.git wsub
> cd wsub
> # maybe have a look at build.sh before running the following
> # it will install a single binary under ~/.local/bin
> # also it will fire up the binary, the server part, wsub, right away
> sh build.sh
> 
> # then from a different terminal
> cd /tmp/wsub/client
> # in zsh, use seq for bash
> MAX_CONNECTIONS=4; for i in {0..$MAX_CONNECTIONS}; do ./client foo; done
> ```
> 
> srv starts listening on a *abstract* unix socket, names after the binary which
> should turn up in the output of this, if you have ss(8) installed:
> 
> `ss -l -x --socket=unix_seqpacket`
> it will be called `@wsub` if you don't change anything.
> 
> client bit just sends it's first arg, "foo" in this case, to the server, and
> srv prints it out into it's stderr.
> 
> 
> --------
> PROBLEM:
> --------
> 
> every calls to io_uring_prep_accept_direct() via q_accept(), before entering
> event_loop(), main.c:587, get properly completed, but subsequent calls to
> io_uring_prep_accept_direct() after entering event_loop(),
> main.c:487 `case ACCEPT:`,
> never turn up on ring's cq! you will notice that all other submissions inside
> event_loop(), to the same ring, get completed fine.
> 
> note also that io_uring_prep_accept_direct() completions make it once there is a
> new connection!
> 
> running the client bit one-by-one might illustrate the point better.
> 
> i also experimented with using IORING_SETUP_SQPOLL, different articles but same
> result for io_uring_prep_accept_direct() submissions.
> 
> thoughts?
> 
> 
> 	- jrun
> 

-- 
Pavel Begunkov

  parent reply	other threads:[~2021-12-09 15:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08 19:07 happy io_uring_prep_accept_direct() submissions go hiding! jrun
2021-12-08 19:16 ` [oops!] " jrun
2021-12-09 15:02 ` Pavel Begunkov [this message]
2021-12-09 17:56   ` jrun
2021-12-09 19:34     ` possible bug with unix sockets jrun
2021-12-09 20:34     ` jrun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox