Nir Soffer
2021-Nov-07 13:27 UTC
[Libguestfs] [PATCH libnbd 2/2] socket-activation: Allow multiple connections
When using qemu-nbd with systemd socket activation, trying to connect additional clients concurrently fails with: nbd_connect_uri: connect: server backlog overflowed, see https://bugzilla.redhat.com/1925045: Resource temporarily unavailable But this bug was fixed in qemu-nbd long time ago; turns out that libnbd has the same bug, creating the server socket with: listen(s, 1); Use SOMAXCONN so we can have multiple connections for better performance. I think this can be very useful for nbdcopy. Signed-off-by: Nir Soffer <nsoffer at redhat.com> --- generator/states-connect-socket-activation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator/states-connect-socket-activation.c b/generator/states-connect-socket-activation.c index 800d963..2abf61b 100644 --- a/generator/states-connect-socket-activation.c +++ b/generator/states-connect-socket-activation.c @@ -147,7 +147,7 @@ STATE_MACHINE { return 0; } - if (listen (s, 1) == -1) { + if (listen (s, SOMAXCONN) == -1) { SET_NEXT_STATE (%.DEAD); set_error (errno, "listen"); close (s); -- 2.31.1
Richard W.M. Jones
2021-Nov-07 13:59 UTC
[Libguestfs] [PATCH libnbd 2/2] socket-activation: Allow multiple connections
On Sun, Nov 07, 2021 at 03:27:47PM +0200, Nir Soffer wrote:> When using qemu-nbd with systemd socket activation, trying to connect > additional clients concurrently fails with: > > nbd_connect_uri: connect: server backlog overflowed, see > https://bugzilla.redhat.com/1925045: Resource temporarily > unavailable > > But this bug was fixed in qemu-nbd long time ago; turns out that libnbd > has the same bug, creating the server socket with: > > listen(s, 1); > > Use SOMAXCONN so we can have multiple connections for better > performance. I think this can be very useful for nbdcopy.Apart from the problems in API mentioned in the other review, this patch ordering isn't bisectable. What's the motivation for this patch series? Rich.> Signed-off-by: Nir Soffer <nsoffer at redhat.com> > --- > generator/states-connect-socket-activation.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/generator/states-connect-socket-activation.c b/generator/states-connect-socket-activation.c > index 800d963..2abf61b 100644 > --- a/generator/states-connect-socket-activation.c > +++ b/generator/states-connect-socket-activation.c > @@ -147,7 +147,7 @@ STATE_MACHINE { > return 0; > } > > - if (listen (s, 1) == -1) { > + if (listen (s, SOMAXCONN) == -1) { > SET_NEXT_STATE (%.DEAD); > set_error (errno, "listen"); > close (s); > -- > 2.31.1-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW