Skip to contentSkip to conversation

Merge QEMU I/O 2017/09/05

GIT PULL Daniel P. Berrange 2 participants 13 messages Sep 5, 2017 Block layer

lore
Share & tools
lore
#0 lore raw

The following changes since commit 32f0f68bb77289b75a82925f712bb52e16eac3ba:

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging (2017-09-01 17:28:54 +0100)

are available in the git repository at:

git://github.com/berrange/qemu tags/pull-qio-20170905-1

for you to fetch changes up to 33fb97121573985b4a57306b8abdb9dd992061fa:

io: fix check for handshake completion in TLS test (2017-09-05 10:20:28 +0100)

----------------------------------------------------------------
Merge QEMU I/O 2017/09/05 v1

----------------------------------------------------------------

Cao jin (1):
util: remove the obsolete non-blocking connect

Daniel P. Berrange (4):
io: fix temp directory used by test-io-channel-tls test
io: fix typo in docs comment for qio_channel_read
io: add new qio_channel_{readv, writev, read, write}_all functions
io: fix check for handshake completion in TLS test

Knut Omang (4):
tests: Add test-listen - a stress test for QEMU socket listen
sockets: factor out a new try_bind() function
sockets: factor out create_fast_reuse_socket
sockets: Handle race condition between binds to the same port

 block/sheepdog.c            |   2 +-
 block/ssh.c                 |   2 +-
 include/io/channel.h        |  92 +++++++++++-
 include/qemu/sockets.h      |  12 +-
 io/channel-socket.c         |   2 +-
 io/channel.c                |  94 ++++++++++++
 tests/Makefile.include      |   2 +
 tests/io-channel-helpers.c  | 102 ++-----------
 tests/test-io-channel-tls.c |   6 +-
 tests/test-listen.c         | 253 ++++++++++++++++++++++++++++++++
 util/qemu-sockets.c         | 343 +++++++++++++++-----------------------------
 11 files changed, 570 insertions(+), 340 deletions(-)
 create mode 100644 tests/test-listen.c
Signature · 1 line
2.13.5
#1 lore raw

[Qemu-devel] [PULL v1 3/9] sockets: factor out a new try_bind() function

From: Knut Omang <[email protected]>

A refactoring step to prepare for the problem exposed by the test-listen test in the previous commit.

Simplify and reorganize the IPv6 specific extra measures and move it out of the for loop to increase code readability. No semantic changes.

---
 util/qemu-sockets.c | 69 ++++++++++++++++++++++++++++++-----------------------
 1 file changed, 39 insertions(+), 30 deletions(-)
util/qemu-sockets.c +39 -30
index 1358c81bcc..b4a2f243f4 100644
@@ -149,6 +149,44 @@ int inet_ai_family_from_address(InetSocketAddress *addr,
     return PF_UNSPEC;
 }
 
+static int try_bind(int socket, InetSocketAddress *saddr, struct addrinfo *e)
+{
+#ifndef IPV6_V6ONLY
+    return bind(socket, e->ai_addr, e->ai_addrlen);
+#else
+    /*
+     * Deals with first & last cases in matrix in comment
+     * for inet_ai_family_from_address().
+     */
+    int v6only =
+        ((!saddr->has_ipv4 && !saddr->has_ipv6) ||
+         (saddr->has_ipv4 && saddr->ipv4 &&
+          saddr->has_ipv6 && saddr->ipv6)) ? 0 : 1;
+    int stat;
+
+ rebind:
+    if (e->ai_family == PF_INET6) {
+        qemu_setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only,
+                        sizeof(v6only));
+    }
+
+    stat = bind(socket, e->ai_addr, e->ai_addrlen);
+    if (!stat) {
+        return 0;
+    }
+
+    /* If we got EADDRINUSE from an IPv6 bind & v6only is unset,
+     * it could be that the IPv4 port is already claimed, so retry
+     * with v6only set
+     */
+    if (e->ai_family == PF_INET6 && errno == EADDRINUSE && !v6only) {
+        v6only = 1;
+        goto rebind;
+    }
+    return stat;
+#endif
+}
+
 static int inet_listen_saddr(InetSocketAddress *saddr,
                              int port_offset,
                              bool update_addr,
@@ -228,39 +266,10 @@ static int inet_listen_saddr(InetSocketAddress *saddr,
         port_min = inet_getport(e);
         port_max = saddr->has_to ? saddr->to + port_offset : port_min;
         for (p = port_min; p <= port_max; p++) {
-#ifdef IPV6_V6ONLY
-            /*
-             * Deals with first & last cases in matrix in comment
-             * for inet_ai_family_from_address().
-             */
-            int v6only =
-                ((!saddr->has_ipv4 && !saddr->has_ipv6) ||
-                 (saddr->has_ipv4 && saddr->ipv4 &&
-                  saddr->has_ipv6 && saddr->ipv6)) ? 0 : 1;
-#endif
             inet_setport(e, p);
-#ifdef IPV6_V6ONLY
-        rebind:
-            if (e->ai_family == PF_INET6) {
-                qemu_setsockopt(slisten, IPPROTO_IPV6, IPV6_V6ONLY, &v6only,
-                                sizeof(v6only));
-            }
-#endif
-            if (bind(slisten, e->ai_addr, e->ai_addrlen) == 0) {
+            if (try_bind(slisten, saddr, e) >= 0) {
                 goto listen;
             }
-
-#ifdef IPV6_V6ONLY
-            /* If we got EADDRINUSE from an IPv6 bind & V6ONLY is unset,
-             * it could be that the IPv4 port is already claimed, so retry
-             * with V6ONLY set
-             */
-            if (e->ai_family == PF_INET6 && errno == EADDRINUSE && !v6only) {
-                v6only = 1;
-                goto rebind;
-            }
-#endif
-
             if (p == port_max) {
                 if (!e->ai_next) {
                     error_setg_errno(errp, errno, "Failed to bind socket");
Signature · 1 line
2.13.5
#2 lore raw

[Qemu-devel] [PULL v1 4/9] sockets: factor out create_fast_reuse_socket

In reply to Daniel P. Berrange

From: Knut Omang <[email protected]>

Another refactoring step to prepare for fixing the problem exposed with the test-listen test in the previous commit

---
 util/qemu-sockets.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
util/qemu-sockets.c +12 -3
index b4a2f243f4..d0d20476e5 100644
@@ -149,6 +149,16 @@ int inet_ai_family_from_address(InetSocketAddress *addr,
     return PF_UNSPEC;
 }
 
+static int create_fast_reuse_socket(struct addrinfo *e)
+{
+    int slisten = qemu_socket(e->ai_family, e->ai_socktype, e->ai_protocol);
+    if (slisten < 0) {
+        return -1;
+    }
+    socket_set_fast_reuse(slisten);
+    return slisten;
+}
+
 static int try_bind(int socket, InetSocketAddress *saddr, struct addrinfo *e)
 {
 #ifndef IPV6_V6ONLY
@@ -253,7 +263,8 @@ static int inet_listen_saddr(InetSocketAddress *saddr,
         getnameinfo((struct sockaddr*)e->ai_addr,e->ai_addrlen,
 		        uaddr,INET6_ADDRSTRLEN,uport,32,
 		        NI_NUMERICHOST | NI_NUMERICSERV);
-        slisten = qemu_socket(e->ai_family, e->ai_socktype, e->ai_protocol);
+
+        slisten = create_fast_reuse_socket(e);
         if (slisten < 0) {
             if (!e->ai_next) {
                 error_setg_errno(errp, errno, "Failed to create socket");
@@ -261,8 +272,6 @@ static int inet_listen_saddr(InetSocketAddress *saddr,
             continue;
         }
 
-        socket_set_fast_reuse(slisten);
-
         port_min = inet_getport(e);
         port_max = saddr->has_to ? saddr->to + port_offset : port_min;
         for (p = port_min; p <= port_max; p++) {
Signature · 1 line
2.13.5
#3 lore raw

[Qemu-devel] [PULL v1 1/9] io: fix temp directory used by test-io-channel-tls test

In reply to Daniel P. Berrange

The test-io-channel-tls test was mistakenly using two of the same directories as test-crypto-tlssession. This causes a sporadic failure when using make -j$BIGNUM.

---
 tests/test-io-channel-tls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/test-io-channel-tls.c +2 -2
index 8eaa208e1b..ff96877323 100644
@@ -127,8 +127,8 @@ static void test_io_channel_tls(const void *opaque)
     /* We'll use this for our fake client-server connection */
     g_assert(socketpair(AF_UNIX, SOCK_STREAM, 0, channel) == 0);
 
-#define CLIENT_CERT_DIR "tests/test-crypto-tlssession-client/"
-#define SERVER_CERT_DIR "tests/test-crypto-tlssession-server/"
+#define CLIENT_CERT_DIR "tests/test-io-channel-tls-client/"
+#define SERVER_CERT_DIR "tests/test-io-channel-tls-server/"
     mkdir(CLIENT_CERT_DIR, 0700);
     mkdir(SERVER_CERT_DIR, 0700);
 
Signature · 1 line
2.13.5
#4 lore raw

[Qemu-devel] [PULL v1 7/9] io: fix typo in docs comment for qio_channel_read

In reply to Daniel P. Berrange
---
 include/io/channel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/io/channel.h +1 -1
index db9bb022a1..54f3dc252f 100644
@@ -299,7 +299,7 @@ ssize_t qio_channel_writev(QIOChannel *ioc,
                            Error **errp);
 
 /**
- * qio_channel_readv:
+ * qio_channel_read:
  * @ioc: the channel object
  * @buf: the memory region to read data into
  * @buflen: the length of @buf
Signature · 1 line
2.13.5
#5 lore raw

[Qemu-devel] [PULL v1 2/9] tests: Add test-listen - a stress test for QEMU socket listen

In reply to Daniel P. Berrange

From: Knut Omang <[email protected]>

There's a potential race condition between multiple bind()'s attempting to bind to the same port, which occasionally allows more than one bind to succeed against the same port.

When a subsequent listen() call is made with the same socket only one will succeed.

The current QEMU code does however not take this situation into account and the listen will cause the code to break out and fail even when there are actually available ports to use.

This test exposes two subtests:

/socket/listen-serial
/socket/listen-compete

The "compete" subtest creates a number of threads and have them all trying to bind to the same port with a large enough offset input to
allow all threads to get it's own port.
The "serial" subtest just does the same, except in series in a
single thread.

The serial version passes, probably in most versions of QEMU.

The parallel version exposes the problem in a relatively reliable way, eg. it fails a majority of times, but not with a 100% rate, occasional passes can be seen. Nevertheless this is quite good given that the bug was tricky to reproduce and has been left undetected for a while.

The problem seems to be present in all versions of QEMU.

The original failure scenario occurred with VNC port allocation in a traditional Xen based build, in different code but with similar functionality.

---
 tests/Makefile.include |   2 +
 tests/test-listen.c    | 253 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 255 insertions(+)
 create mode 100644 tests/test-listen.c
tests/Makefile.include +2 -0
index f08b7418f0..a231754517 100644
@@ -151,6 +151,7 @@ check-unit-y += tests/test-bufferiszero$(EXESUF)
 gcov-files-check-bufferiszero-y = util/bufferiszero.c
 check-unit-y += tests/test-uuid$(EXESUF)
 check-unit-y += tests/ptimer-test$(EXESUF)
+#check-unit-y += tests/test-listen$(EXESUF)
 gcov-files-ptimer-test-y = hw/core/ptimer.c
 check-unit-y += tests/test-qapi-util$(EXESUF)
 gcov-files-test-qapi-util-y = qapi/qapi-util.c
@@ -796,6 +797,7 @@ tests/test-arm-mptimer$(EXESUF): tests/test-arm-mptimer.o
 tests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y)
 tests/numa-test$(EXESUF): tests/numa-test.o
 tests/vmgenid-test$(EXESUF): tests/vmgenid-test.o tests/boot-sector.o tests/acpi-utils.o
+tests/test-listen$(EXESUF): tests/test-listen.o $(test-util-obj-y)
 
 tests/migration/stress$(EXESUF): tests/migration/stress.o
 	$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
tests/test-listen.c new file +253 -0

253 lines not on this page · raw message

Signature · 1 line
2.13.5
#6 lore raw

[Qemu-devel] [PULL v1 6/9] util: remove the obsolete non-blocking connect

In reply to Daniel P. Berrange

From: Cao jin <[email protected]>

The non-blocking connect mechanism is obsolete, and it doesn't work well in inet connection, because it will call getaddrinfo first and getaddrinfo will blocks on DNS lookups. Since commit e65c67e4 & d984464e, the non-blocking connect of migration goes through QIOChannel in a different manner(using a thread), and nobody use this old non-blocking connect anymore.

Any newly written code which needs a non-blocking connect should use the QIOChannel code, so we can drop NonBlockingConnectHandler as a concept entirely.

---
 block/sheepdog.c       |   2 +-
 block/ssh.c            |   2 +-
 include/qemu/sockets.h |  12 +--
 io/channel-socket.c    |   2 +-
 util/qemu-sockets.c    | 205 ++++++-------------------------------------------
 5 files changed, 28 insertions(+), 195 deletions(-)
block/sheepdog.c +1 -1
index abb2e79065..64ab07f3b7 100644
@@ -591,7 +591,7 @@ static int connect_to_sdog(BDRVSheepdogState *s, Error **errp)
 {
     int fd;
 
-    fd = socket_connect(s->addr, NULL, NULL, errp);
+    fd = socket_connect(s->addr, errp);
 
     if (s->addr->type == SOCKET_ADDRESS_TYPE_INET && fd >= 0) {
         int ret = socket_set_nodelay(fd);
block/ssh.c +1 -1
index e8f0404c03..b049a16eb9 100644
@@ -678,7 +678,7 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options,
     }
 
     /* Open the socket and connect. */
-    s->sock = inet_connect_saddr(s->inet, NULL, NULL, errp);
+    s->sock = inet_connect_saddr(s->inet, errp);
     if (s->sock < 0) {
         ret = -EIO;
         goto err;
include/qemu/sockets.h +2 -10
index ef6b5591f7..639cc079d9 100644
@@ -27,18 +27,11 @@ int socket_set_fast_reuse(int fd);
 #define SHUT_RDWR 2
 #endif
 
-/* callback function for nonblocking connect
- * valid fd on success, negative error code on failure
- */
-typedef void NonBlockingConnectHandler(int fd, Error *err, void *opaque);
-
 int inet_ai_family_from_address(InetSocketAddress *addr,
                                 Error **errp);
 int inet_parse(InetSocketAddress *addr, const char *str, Error **errp);
 int inet_connect(const char *str, Error **errp);
-int inet_connect_saddr(InetSocketAddress *saddr,
-                       NonBlockingConnectHandler *callback, void *opaque,
-                       Error **errp);
+int inet_connect_saddr(InetSocketAddress *saddr, Error **errp);
 
 NetworkAddressFamily inet_netfamily(int family);
 
@@ -46,8 +39,7 @@ int unix_listen(const char *path, char *ostr, int olen, Error **errp);
 int unix_connect(const char *path, Error **errp);
 
 SocketAddress *socket_parse(const char *str, Error **errp);
-int socket_connect(SocketAddress *addr, NonBlockingConnectHandler *callback,
-                   void *opaque, Error **errp);
+int socket_connect(SocketAddress *addr, Error **errp);
 int socket_listen(SocketAddress *addr, Error **errp);
 void socket_listen_cleanup(int fd, Error **errp);
 int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp);
io/channel-socket.c +1 -1
index 591d27e8c3..563e297357 100644
@@ -140,7 +140,7 @@ int qio_channel_socket_connect_sync(QIOChannelSocket *ioc,
     int fd;
 
     trace_qio_channel_socket_connect_sync(ioc, addr);
-    fd = socket_connect(addr, NULL, NULL, errp);
+    fd = socket_connect(addr, errp);
     if (fd < 0) {
         trace_qio_channel_socket_connect_fail(ioc);
         return -1;
util/qemu-sockets.c +23 -182

371 lines not on this page · raw message

Signature · 1 line
2.13.5
#7 lore raw

[Qemu-devel] [PULL v1 9/9] io: fix check for handshake completion in TLS test

In reply to Daniel P. Berrange

The TLS I/O channel test had mistakenly used && instead of || when checking for handshake completion. As a result it could terminate the handshake process before it had actually completed. This was harmless before but changes in GNUTLS 3.6.0 exposed this bug and caused the test suite to fail.

---
 tests/test-io-channel-tls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/test-io-channel-tls.c +1 -1
index ff96877323..a210d01ba5 100644
@@ -218,7 +218,7 @@ static void test_io_channel_tls(const void *opaque)
     mainloop = g_main_context_default();
     do {
         g_main_context_iteration(mainloop, TRUE);
-    } while (!clientHandshake.finished &&
+    } while (!clientHandshake.finished ||
              !serverHandshake.finished);
 
     g_assert(clientHandshake.failed == data->expectClientFail);
Signature · 1 line
2.13.5
#8 lore raw

[Qemu-devel] [PULL v1 5/9] sockets: Handle race condition between binds to the same port

In reply to Daniel P. Berrange

From: Knut Omang <[email protected]>

If an offset of ports is specified to the inet_listen_saddr function(), and two or more processes tries to bind from these ports at the same time, occasionally more than one process may be able to bind to the same port. The condition is detected by listen() but too late to avoid a failure.

This function is called by socket_listen() and used
by all socket listening code in QEMU, so all cases where any form of dynamic port selection is used should be subject to this issue.

Add code to close and re-establish the socket when this condition is observed, hiding the race condition from the user.

Also clean up some issues with error handling to allow more accurate reporting of the cause of an error.

This has been developed and tested by means of the test-listen unit test in the previous commit. Enable the test for make check now that it passes.

---
 tests/Makefile.include |  2 +-
 util/qemu-sockets.c    | 58 +++++++++++++++++++++++++++++++++++---------------
 2 files changed, 42 insertions(+), 18 deletions(-)
tests/Makefile.include +1 -1
index a231754517..eef4088d5c 100644
@@ -151,7 +151,7 @@ check-unit-y += tests/test-bufferiszero$(EXESUF)
 gcov-files-check-bufferiszero-y = util/bufferiszero.c
 check-unit-y += tests/test-uuid$(EXESUF)
 check-unit-y += tests/ptimer-test$(EXESUF)
-#check-unit-y += tests/test-listen$(EXESUF)
+check-unit-y += tests/test-listen$(EXESUF)
 gcov-files-ptimer-test-y = hw/core/ptimer.c
 check-unit-y += tests/test-qapi-util$(EXESUF)
 gcov-files-test-qapi-util-y = qapi/qapi-util.c
util/qemu-sockets.c +41 -17

92 lines not on this page · raw message

Signature · 1 line
2.13.5
#9 lore raw

[Qemu-devel] [PULL v1 8/9] io: add new qio_channel_{readv, writev, read, write}_all functions

In reply to Daniel P. Berrange

These functions wait until they are able to read / write the full requested data buffer(s).

---
 include/io/channel.h       |  90 +++++++++++++++++++++++++++++++++++++++
 io/channel.c               |  94 +++++++++++++++++++++++++++++++++++++++++
 tests/io-channel-helpers.c | 102 ++++-----------------------------------------
 3 files changed, 193 insertions(+), 93 deletions(-)
include/io/channel.h +90 -0
index 54f3dc252f..8f25893c45 100644
@@ -269,6 +269,58 @@ ssize_t qio_channel_writev_full(QIOChannel *ioc,
                                 Error **errp);
 
 /**
+ * qio_channel_readv_all:
+ * @ioc: the channel object
+ * @iov: the array of memory regions to read data into
+ * @niov: the length of the @iov array
+ * @errp: pointer to a NULL-initialized error object
+ *
+ * Read data from the IO channel, storing it in the
+ * memory regions referenced by @iov. Each element
+ * in the @iov will be fully populated with data
+ * before the next one is used. The @niov parameter
+ * specifies the total number of elements in @iov.
+ *
+ * The function will wait for all requested data
+ * to be read, yielding from the current coroutine
+ * if required.
+ *
+ * If end-of-file occurs before all requested data
+ * has been read, an error will be reported.
+ *
+ * Returns: 0 if all bytes were read, or -1 on error
+ */
+int qio_channel_readv_all(QIOChannel *ioc,
+                          const struct iovec *iov,
+                          size_t niov,
+                          Error **errp);
+
+
+/**
+ * qio_channel_writev_all:
+ * @ioc: the channel object
+ * @iov: the array of memory regions to write data from
+ * @niov: the length of the @iov array
+ * @errp: pointer to a NULL-initialized error object
+ *
+ * Write data to the IO channel, reading it from the
+ * memory regions referenced by @iov. Each element
+ * in the @iov will be fully sent, before the next
+ * one is used. The @niov parameter specifies the
+ * total number of elements in @iov.
+ *
+ * The function will wait for all requested data
+ * to be written, yielding from the current coroutine
+ * if required.
+ *
+ * Returns: 0 if all bytes were written, or -1 on error
+ */
+int qio_channel_writev_all(QIOChannel *ioc,
+                           const struct iovec *iov,
+                           size_t niov,
+                           Error **erp);
+
+/**
  * qio_channel_readv:
  * @ioc: the channel object
  * @iov: the array of memory regions to read data into
@@ -331,6 +383,44 @@ ssize_t qio_channel_write(QIOChannel *ioc,
                           Error **errp);
 
 /**
+ * qio_channel_read_all:
+ * @ioc: the channel object
+ * @buf: the memory region to read data into
+ * @buflen: the number of bytes to @buf
+ * @errp: pointer to a NULL-initialized error object
+ *
+ * Reads @buflen bytes into @buf, possibly blocking or (if the
+ * channel is non-blocking) yielding from the current coroutine
+ * multiple times until the entire content is read. If end-of-file
+ * occurs it will return an error rather than a short-read. Otherwise
+ * behaves as qio_channel_read().
+ *
+ * Returns: 0 if all bytes were read, or -1 on error
+ */
+int qio_channel_read_all(QIOChannel *ioc,
+                         char *buf,
+                         size_t buflen,
+                         Error **errp);
+/**
+ * qio_channel_write_all:
+ * @ioc: the channel object
+ * @buf: the memory region to write data into
+ * @buflen: the number of bytes to @buf
+ * @errp: pointer to a NULL-initialized error object
+ *
+ * Writes @buflen bytes from @buf, possibly blocking or (if the
+ * channel is non-blocking) yielding from the current coroutine
+ * multiple times until the entire content is written.  Otherwise
+ * behaves as qio_channel_write().
+ *
+ * Returns: 0 if all bytes were written, or -1 on error
+ */
+int qio_channel_write_all(QIOChannel *ioc,
+                          const char *buf,
+                          size_t buflen,
+                          Error **errp);
+
+/**
  * qio_channel_set_blocking:
  * @ioc: the channel object
  * @enabled: the blocking flag state
io/channel.c +94 -0

112 lines not on this page · raw message

tests/io-channel-helpers.c +9 -93

130 lines not on this page · raw message

Signature · 1 line
2.13.5
#10 lore raw
In reply to Daniel P. Berrange
Quoted 8 lines · Daniel P. Berrange

The following changes since commit 32f0f68bb77289b75a82925f712bb52e16eac3ba:

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging (2017-09-01 17:28:54 +0100)

are available in the git repository at:

git://github.com/berrange/qemu tags/pull-qio-20170905-1

Quoted 8 lines

for you to fetch changes up to 33fb97121573985b4a57306b8abdb9dd992061fa:

io: fix check for handshake completion in TLS test (2017-09-05 10:20:28 +0100)

----------------------------------------------------------------
Merge QEMU I/O 2017/09/05 v1

----------------------------------------------------------------

I get a build failure with this I'm afraid:

FreeBSD:
/root/qemu/tests/test-listen.c:53:19: error: use of undeclared identifier 'EAI_ADDRFAMILY'

        if (rc == EAI_ADDRFAMILY ||
                  ^

and test-listen fails on my x86-64 Linux box:
GTESTER tests/test-listen
** Failed to assign a port to thread 0 (errno = 98)
** Failed to assign a port to thread 1 (errno = 98)
** Failed to assign a port to thread 2 (errno = 98)
** Failed to assign a port to thread 3 (errno = 98)
** Failed to assign a port to thread 4 (errno = 98)
** Failed to assign a port to thread 5 (errno = 98)
** Failed to assign a port to thread 6 (errno = 98)
[snip 7..96 same message]
** Failed to assign a port to thread 97 (errno = 98)
** Failed to assign a port to thread 98 (errno = 98)
** Failed to assign a port to thread 99 (errno = 98)
** Failed to assign a port to thread 100 (errno = 110)
** Failed to assign a port to thread 101 (errno = 110)
** Failed to assign a port to thread 102 (errno = 110)
** Failed to assign a port to thread 103 (errno = 110)
[snip more with =110 message]
** Failed to assign a port to thread 198 (errno = 110)
** Failed to assign a port to thread 199 (errno = 110)
** ERROR:/home/petmay01/linaro/qemu-for-merges/tests/test-listen.c:195:listen_compete_nthr:
assertion failed (failed_listens == 0): (200 == 0)
GTester: last random seed: R02S501c6ff1c5ff42cf11b1318e0de42bc5

(98 is EADDRINUSE and 110 is ETIMEDOUT I think.)

aarch64 host fails sort of similarly:
TEST: tests/test-listen... (pid=12632)
/socket/listen-serial/ipv4: OK
/socket/listen-serial/ipv6:
** Failed to assign a port to th
read 0 (errno = 98)
** Failed to assign a port to thread 1 (errno = 98)
** Failed to assign a port to thread 2 (errno = 98)
[snip]
** Failed to assign a port to thread 199 (errno = 98)
** ERROR:/home/peter.maydell/qemu/tests/test-listen.c:195:listen_compete_nthr:
assertion failed (failed_listens == 0): (200 == 0)
FAIL
GTester: last random seed: R02Sbd34929fe0b3304c2873c42c94643648 (pid=12634)

  /socket/listen-serial/generic:                                       OK
  /socket/listen-compete/ipv4:                                         OK
  /socket/listen-compete/ipv6:                                         OK
  /socket/listen-compete/generic:                                      OK

FAIL: tests/test-listen

except that it's errno 98 all the way through.

thanks
-- PMM

#11 lore raw
Quoted 1 line · Peter Maydell

and test-listen fails on my x86-64 Linux box:

OpenBSD fails too, but only starting at thread 124, and it fails like this for all the tests whereas Linux only failed on the ipv6 test:

TEST: tests/test-listen... (pid=12010)
/socket/listen-serial/ipv4:
** Failed to assign a port to thread 124 (errno = 48) ** Failed to assign a port to thread 125 (errno = 48) ** Failed to assign a port to thread 126 (errno = 48) ** Failed to assign a port to thread 127 (errno = 48) ** Failed to assign a port to thread 128 (errno = 48) ** Failed to assign a port to thread 129 (errno = 48) ** Failed to assign a port to thread 130 (errno = 48) ** Failed to assign a port to thread 131 (errno = 48) ** Failed to assign a port to thread 132 (errno = 48) [snip]
** Failed to assign a port to thread 197 (errno = 48) ** Failed to assign a port to thread 198 (errno = 48) ** Failed to assign a port to thread 199 (errno = 48) ** ERROR:/home/qemu/tests/test-listen.c:195:listen_compete_nthr:
assertion failed (failed_listens == 0): (76 == 0) FAIL
GTester: last random seed: R02S5df2be6aaaf10151ac566254ab2f7e88 (pid=37081)
/socket/listen-serial/ipv6:
** Failed to assign a port to thread 124 (errno = 48) ** Failed to assign a port to thread 125 (errno = 48) ** Failed to assign a port to thread 126 (errno = 48) ** Failed to assign a port to thread 127 (errno = 48) [snip]
** Failed to assign a port to thread 198 (errno = 48) ** Failed to assign a port to thread 199 (errno = 48) ** ERROR:/home/qemu/tests/test-listen.c:195:listen_compete_nthr:
assertion failed (failed_listens == 0): (76 == 0) FAIL
GTester: last random seed: R02Sa41cf200664d43a074a38d7fff7b5393 (pid=93074)
/socket/listen-serial/generic:
** Failed to assign a port to thread 124 (errno = 48) ** Failed to assign a port to thread 125 (errno = 48) ** Failed to assign a port to thread 126 (errno = 48) ** Failed to assign a port to thread 127 (errno = 48) [snip]
** Failed to assign a port to thread 198 (errno = 48) ** Failed to assign a port to thread 199 (errno = 48) ** ERROR:/home/qemu/tests/test-listen.c:195:listen_compete_nthr:
assertion failed (failed_listens == 0): (76 == 0) FAIL
GTester: last random seed: R02S072bffdb79ddc59e35f0b9c1f8b8f69f (pid=56289)
/socket/listen-compete/ipv4:
** Failed to assign a port to thread 124 (errno = 24) ** Failed to assign a port to thread 127 (errno = 24) ** Failed to assign a port to thread 128 (errno = 24) ** Failed to assign a port to thread 129 (errno = 24) ** Failed to assign a port to thread 130 (errno = 24) [etc etc]

thanks
-- PMM

#12 lore raw
In reply to Peter Maydell
Quoted 18 lines · Peter Maydell
Quoted 8 lines · Daniel P. Berrange

The following changes since commit 32f0f68bb77289b75a82925f712bb52e16eac3ba:

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging (2017-09-01 17:28:54 +0100)

are available in the git repository at:

git://github.com/berrange/qemu tags/pull-qio-20170905-1

Quoted 8 lines

for you to fetch changes up to 33fb97121573985b4a57306b8abdb9dd992061fa:

io: fix check for handshake completion in TLS test (2017-09-05 10:20:28 +0100)

----------------------------------------------------------------
Merge QEMU I/O 2017/09/05 v1

----------------------------------------------------------------

Quoted 7 lines

I get a build failure with this I'm afraid:

FreeBSD:
/root/qemu/tests/test-listen.c:53:19: error: use of undeclared identifier 'EAI_ADDRFAMILY'

        if (rc == EAI_ADDRFAMILY ||
                  ^

Opps, ok, that's an easy fix.

Quoted 43 lines

and test-listen fails on my x86-64 Linux box:
GTESTER tests/test-listen
** Failed to assign a port to thread 0 (errno = 98)
** Failed to assign a port to thread 1 (errno = 98)
** Failed to assign a port to thread 2 (errno = 98)
** Failed to assign a port to thread 3 (errno = 98)
** Failed to assign a port to thread 4 (errno = 98)
** Failed to assign a port to thread 5 (errno = 98)
** Failed to assign a port to thread 6 (errno = 98)
[snip 7..96 same message]
** Failed to assign a port to thread 97 (errno = 98)
** Failed to assign a port to thread 98 (errno = 98)
** Failed to assign a port to thread 99 (errno = 98)
** Failed to assign a port to thread 100 (errno = 110)
** Failed to assign a port to thread 101 (errno = 110)
** Failed to assign a port to thread 102 (errno = 110)
** Failed to assign a port to thread 103 (errno = 110)
[snip more with =110 message]
** Failed to assign a port to thread 198 (errno = 110)
** Failed to assign a port to thread 199 (errno = 110)
** ERROR:/home/petmay01/linaro/qemu-for-merges/tests/test-listen.c:195:listen_compete_nthr:
assertion failed (failed_listens == 0): (200 == 0)
GTester: last random seed: R02S501c6ff1c5ff42cf11b1318e0de42bc5

(98 is EADDRINUSE and 110 is ETIMEDOUT I think.)

aarch64 host fails sort of similarly:
TEST: tests/test-listen... (pid=12632)
/socket/listen-serial/ipv4: OK
/socket/listen-serial/ipv6:
** Failed to assign a port to th
read 0 (errno = 98)
** Failed to assign a port to thread 1 (errno = 98)
** Failed to assign a port to thread 2 (errno = 98)
[snip]
** Failed to assign a port to thread 199 (errno = 98)
** ERROR:/home/peter.maydell/qemu/tests/test-listen.c:195:listen_compete_nthr:
assertion failed (failed_listens == 0): (200 == 0)
FAIL
GTester: last random seed: R02Sbd34929fe0b3304c2873c42c94643648 (pid=12634)

Quoted 7 lines
  /socket/listen-serial/generic:                                       OK
  /socket/listen-compete/ipv4:                                         OK
  /socket/listen-compete/ipv6:                                         OK
  /socket/listen-compete/generic:                                      OK

FAIL: tests/test-listen

except that it's errno 98 all the way through.

Knut, do you have any thoughts on why Peter would see such failures in this test ?

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|