Skip to contentSkip to conversation

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

PATCH In review Ilya Leoshkevich 1 participant 2 messages Jun 1, 2021 – Jul 28, 2021

lore
Share & tools
lore
#0 lore raw

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

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.

---
 tests/tcg/multiarch/linux-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/tcg/multiarch/linux-test.c +1 -1
index eba07273f7..3b256f6c02 100644
@@ -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;
 
 }
Signature · 1 line
2.31.1
#1 lore raw
Quoted 26 lines · Ilya Leoshkevich

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.

---
 tests/tcg/multiarch/linux-test.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
tests/tcg/multiarch/linux-test.c +1 -1
index eba07273f7..3b256f6c02 100644
@@ -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;
Quoted 2 lines


 }

Hello,

I would like to ping this patch.

Best regards,
Ilya