From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id B795B2005C; Sat, 29 Nov 2025 20:02:35 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 08E1C20052; Sat, 29 Nov 2025 20:02:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_PASS,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from mail.cyberchaos.dev (mail.cyberchaos.dev [IPv6:2a0f:4ac0::3a11]) by atuin.qyliss.net (Postfix) with ESMTPS id C817B20051 for ; Sat, 29 Nov 2025 20:02:32 +0000 (UTC) Message-ID: <7a5cc34b-7ec4-450f-bce4-0dc4e86800cb@yuka.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuka.dev; s=mail; t=1764446550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=EDEIpGRX87t3ec3YvOuvwGFvfyML9V8KqaQSBFwhvgY=; b=ixmZIleddXcCh2E5DHaiPVRK+WGJ2X367q/C8A+sAffdV25D+f+eGwyFRD9DQIwNvdRnPM 8i55mt8tqhN/sYMFS4Wsw2McA5YPb5z6qoYdVdBg8Ia7jYn7sYpaEPowfXByOWW0FjRd/a YKkZ/FRh6murb0gUTEhFvmjZy5Gw94c= Date: Sat, 29 Nov 2025 21:02:30 +0100 MIME-Version: 1.0 Subject: Re: [PATCH v2] release/checks/integration: handle partial sends To: Alyssa Ross References: <20251129180016.3895-2-hi@alyssa.is> Content-Language: en-US From: Yureka Autocrypt: addr=yuka@yuka.dev; keydata= xjMEZ3vnnhYJKwYBBAHaRw8BAQdAn6RVMnaxLzmDDx+J3jSUGY7BqjyDhsWhdwKBSI6QpXfN Fll1cmVrYSA8eXVrYUB5dWthLmRldj7CjgQTFgoANhYhBPGINbLQ3ypM7JNhigKbtnC7kwpH BQJne+eeAhsDBAsJCAcEFQoJCAUWAgMBAAIeBQIXgAAKCRACm7Zwu5MKRx1qAP9ToLaOMd73 VVf1JdwoMc5G44OZfKNk/+ezt9Dl2oqZdQD/Xvgd0lytU3BZ4WnYeMNzo2xHeRxXmX+MfXhA D33tzQ/OOARne+eeEgorBgEEAZdVAQUBAQdAIs9uImfvgSCnJOcfvzshLuaSRJ/a0Vp/9rUA eBGZq10DAQgHwngEGBYKACAWIQTxiDWy0N8qTOyTYYoCm7Zwu5MKRwUCZ3vnngIbDAAKCRAC m7Zwu5MKRyW9AP0dBOuwgWso+QjBZUsbuEmGGUz2OWtszs2Yb7087RMerwEA3al6E7vqq0HC 7LiB3nisU+xqQojJ4n/fWCu70iEkjQw= In-Reply-To: <20251129180016.3895-2-hi@alyssa.is> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: 564V5ADC5CRBBBX6ZJPEBSG7RWOSRBL2 X-Message-ID-Hash: 564V5ADC5CRBBBX6ZJPEBSG7RWOSRBL2 X-MailFrom: yuka@yuka.dev X-Mailman-Rule-Hits: member-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address CC: devel@spectrum-os.org X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 11/29/25 19:00, Alyssa Ross wrote: > Sometimes we see a test failure that looks like this: > > unexpected connection data: qemu-system-aarch64: terminating on signal 15 from pid 184 () > > I think this is because, now that the nc command in the networking > integration test has a timeout, it's possible for it to time out after > having opened the connection, but before having written all its input > to it. Therefore, ignore connections that send a prefix of the > expected data (including nothing), and just wait for the next > connection rather than failing if that happens. > > Closes: https://spectrum-os.org/lists/archives/spectrum-devel/875xbl33vw.fsf@alyssa.is/ > Fixes: c61b297 ("release/checks/integration: add nc timeout") > Signed-off-by: Alyssa Ross > --- > v2: close connections when finished reading. > v1: https://spectrum-os.org/lists/archives/spectrum-devel/20251129163521.717709-2-hi@alyssa.is/ > > release/checks/integration/networking.c | 50 +++++++++++++++---------- > 1 file changed, 31 insertions(+), 19 deletions(-) > > diff --git a/release/checks/integration/networking.c b/release/checks/integration/networking.c > index 97d7895..df76ec5 100644 > --- a/release/checks/integration/networking.c > +++ b/release/checks/integration/networking.c > @@ -57,32 +57,44 @@ static int setup_server(void) > > static void expect_connection(int listener) > { > - int conn_fd; > - FILE *conn; > + int conn, r; > char msg[7]; > size_t len; > > - fputs("waiting for server connection\n", stderr); > - if ((conn_fd = accept(listener, nullptr, nullptr)) == -1) { > - perror("accept"); > - exit(EXIT_FAILURE); > - } > - fputs("accepted connection!\n", stderr); > - if (!(conn = fdopen(conn_fd, "r"))) { > - perror("fdopen(server connection)"); > - exit(EXIT_FAILURE); > - } > + for (;;) { > + len = 0; > > - len = fread(msg, 1, sizeof msg, conn); > - if (len != 6 || memcmp("hello\n", msg, 6)) { > - if (ferror(conn)) > - perror("fread(server connection)"); > - else > + fputs("waiting for server connection\n", stderr); > + if ((conn = accept(listener, nullptr, nullptr)) == -1) { > + perror("accept"); > + exit(EXIT_FAILURE); > + } > + fputs("accepted connection!\n", stderr); > + > + for (;;) { > + r = read(conn, msg + len, sizeof msg - len); > + if (r == -1) { > + perror("read"); > + exit(EXIT_FAILURE); > + } > + if (r == 0) > + break; > + len += r; > + } > + close(conn); > + > + if (memcmp("hello\n", msg, len) || len > 6) { > fprintf(stderr, "unexpected connection data: %.*s", > (int)len, msg); > - exit(EXIT_FAILURE); > + exit(EXIT_FAILURE); > + } > + > + // If connection was disconnect partway through, try again. > + if (len < 6) > + continue; > + > + return; > } > - fclose(conn); > } > > static void drain_connections(int listener) > > base-commit: 067c6a5d50971242f9cb8ac0ac76e20d88a9b5c1 Reviewed-by: Yureka Lilian