qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sockets: Use SOMAXCONN for Unix socket listen()
@ 2021-02-04 22:20 Eric Blake
  2021-02-05  9:55 ` Daniel P. Berrangé
  2021-02-05 10:01 ` Richard W.M. Jones
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Blake @ 2021-02-04 22:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: berrange, rjones, qemu-block, Gerd Hoffmann

Our default of a backlog of 1 connection is rather puny, particularly
for scenarios where we expect multiple listeners to connect (such as
qemu-nbd -e X).  For Unix sockets, there's no real harm in supporting
a larger backlog, and a definite benefit to the clients: at least on
Linux, a client trying to connect to a Unix socket with a backlog gets
an EAGAIN failure with no way to poll() for when the backlog is no
longer present short of sleeping an arbitrary amount of time before
retrying.

See https://bugzilla.redhat.com/1925045 for a demonstration of where
our low backlog prevents libnbd from connecting as many parallel
clients as it wants.

Reported-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 util/qemu-sockets.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 8af0278f15c6..a7573e9f0fda 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1059,7 +1059,7 @@ int unix_listen(const char *str, Error **errp)

     saddr = g_new0(UnixSocketAddress, 1);
     saddr->path = g_strdup(str);
-    sock = unix_listen_saddr(saddr, 1, errp);
+    sock = unix_listen_saddr(saddr, SOMAXCONN, errp);
     qapi_free_UnixSocketAddress(saddr);
     return sock;
 }
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-05 19:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-04 22:20 [PATCH] sockets: Use SOMAXCONN for Unix socket listen() Eric Blake
2021-02-05  9:55 ` Daniel P. Berrangé
2021-02-05 19:04   ` Eric Blake
2021-02-05 10:01 ` Richard W.M. Jones

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).