[PATCH] tests/tcg/linux-test: Fix random hangs in test_socket

Ilya Leoshkevich posted 1 patch 2 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/next-importer-push tags/patchew/20210601142030.3129967-1-iii@linux.ibm.com
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>
There is a newer version of this series
tests/tcg/multiarch/linux-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] tests/tcg/linux-test: Fix random hangs in test_socket
Posted by Ilya Leoshkevich 2 years, 10 months ago
test_socket hangs randomly in connect(), especially when run without
qemu. Apparently the reason is that linux started treating backlog
value of 0 literally instead of rounding it up since v4.4 (commit
ef547f2ac16b).

So set it to 1 instead.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tests/tcg/multiarch/linux-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
index eba07273f7..3b256f6c02 100644
--- a/tests/tcg/multiarch/linux-test.c
+++ b/tests/tcg/multiarch/linux-test.c
@@ -263,7 +263,7 @@ static int server_socket(void)
     sockaddr.sin_port = htons(0); /* choose random ephemeral port) */
     sockaddr.sin_addr.s_addr = 0;
     chk_error(bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)));
-    chk_error(listen(fd, 0));
+    chk_error(listen(fd, 1));
     return fd;
 
 }
-- 
2.31.1


Re: [PATCH PING] tests/tcg/linux-test: Fix random hangs in test_socket
Posted by Ilya Leoshkevich 2 years, 8 months ago
On Tue, 2021-06-01 at 16:20 +0200, Ilya Leoshkevich wrote:
> test_socket hangs randomly in connect(), especially when run without
> qemu. Apparently the reason is that linux started treating backlog
> value of 0 literally instead of rounding it up since v4.4 (commit
> ef547f2ac16b).
> 
> So set it to 1 instead.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  tests/tcg/multiarch/linux-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/tcg/multiarch/linux-test.c
> b/tests/tcg/multiarch/linux-test.c
> index eba07273f7..3b256f6c02 100644
> --- a/tests/tcg/multiarch/linux-test.c
> +++ b/tests/tcg/multiarch/linux-test.c
> @@ -263,7 +263,7 @@ static int server_socket(void)
>      sockaddr.sin_port = htons(0); /* choose random ephemeral port)
> */
>      sockaddr.sin_addr.s_addr = 0;
>      chk_error(bind(fd, (struct sockaddr *)&sockaddr,
> sizeof(sockaddr)));
> -    chk_error(listen(fd, 0));
> +    chk_error(listen(fd, 1));
>      return fd;
>  
>  }

Hello,

I would like to ping this patch.

Best regards,
Ilya