From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Jakub Sitnicki <jakub@cloudflare.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
kernel-team@cloudflare.com
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix spurious failures in accept due to EAGAIN
Date: Thu, 12 Mar 2020 10:57:08 -0700 [thread overview]
Message-ID: <CAEf4BzbsDMbmury9Z-+j=egsfJf4uKxsu0Fsdr4YpP1FgvBiiQ@mail.gmail.com> (raw)
In-Reply-To: <20200312171105.533690-1-jakub@cloudflare.com>
On Thu, Mar 12, 2020 at 10:11 AM Jakub Sitnicki <jakub@cloudflare.com> wrote:
>
> Andrii Nakryiko reports that sockmap_listen test suite is frequently
> failing due to accept() calls erroring out with EAGAIN:
>
> ./test_progs:connect_accept_thread:733: accept: Resource temporarily unavailable
> connect_accept_thread:FAIL:733
>
> This is because we are needlessly putting the listening TCP sockets in
> non-blocking mode.
>
> Fix it by using the default blocking mode in all tests in this suite.
>
> Fixes: 44d28be2b8d4 ("selftests/bpf: Tests for sockmap/sockhash holding listening sockets")
> Reported-by: Andrii Nakryiko <andrii.nakryiko@gmail.com>
> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
> ---
Thanks for looking into this. Can you please verify that test
successfully fails (not hangs) when, say, network is down (do `ip link
set lo down` before running test?). The reason I'm asking is that I
just fixed a problem in tcp_rtt selftest, in which accept() would
block forever, even if listening socket was closed.
> tools/testing/selftests/bpf/prog_tests/sockmap_listen.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> index 52aa468bdccd..90271ec90388 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> @@ -754,7 +754,7 @@ static void test_syn_recv_insert_delete(int family, int sotype, int mapfd)
> int err, s;
> u64 value;
>
> - s = socket_loopback(family, sotype | SOCK_NONBLOCK);
> + s = socket_loopback(family, sotype);
> if (s < 0)
> return;
>
> @@ -896,7 +896,7 @@ static void redir_to_connected(int family, int sotype, int sock_mapfd,
>
> zero_verdict_count(verd_mapfd);
>
> - s = socket_loopback(family, sotype | SOCK_NONBLOCK);
> + s = socket_loopback(family, sotype);
> if (s < 0)
> return;
>
> @@ -1028,7 +1028,7 @@ static void redir_to_listening(int family, int sotype, int sock_mapfd,
>
> zero_verdict_count(verd_mapfd);
>
> - s = socket_loopback(family, sotype | SOCK_NONBLOCK);
> + s = socket_loopback(family, sotype);
> if (s < 0)
> return;
>
> --
> 2.24.1
>
next prev parent reply other threads:[~2020-03-12 17:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-12 17:11 [PATCH bpf-next] selftests/bpf: Fix spurious failures in accept due to EAGAIN Jakub Sitnicki
2020-03-12 17:57 ` Andrii Nakryiko [this message]
2020-03-12 19:19 ` Jakub Sitnicki
2020-03-13 16:42 ` Jakub Sitnicki
2020-03-13 18:30 ` Andrii Nakryiko
2020-03-14 2:48 ` Alexei Starovoitov
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 \
--in-reply-to='CAEf4BzbsDMbmury9Z-+j=egsfJf4uKxsu0Fsdr4YpP1FgvBiiQ@mail.gmail.com' \
--to=andrii.nakryiko@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=jakub@cloudflare.com \
--cc=kernel-team@cloudflare.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).