Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Oct 2025 21:07:15 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d9c94e5eefc0 - main - tests/netinet: fix so_reuseport_lb_test flakyness
Message-ID:  <202510072107.597L7Fmr006474@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=d9c94e5eefc0d1ed772cc3af15d92f1960ba73a6

commit d9c94e5eefc0d1ed772cc3af15d92f1960ba73a6
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-10-07 21:02:29 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-10-07 21:02:29 +0000

    tests/netinet: fix so_reuseport_lb_test flakyness
    
    Stop the threads before exiting test body.  Otherwise there is a chance
    threads would use the softc that is stored on the main thread stack after
    it is destroyed and the test would fail.  Stop the threads in the reverse
    order, so that listener is stopped after all connectors are stopped.
    
    Tested by:      olivier
---
 tests/sys/netinet/so_reuseport_lb_test.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/sys/netinet/so_reuseport_lb_test.c b/tests/sys/netinet/so_reuseport_lb_test.c
index fa9d6e425884..0479bd070ca6 100644
--- a/tests/sys/netinet/so_reuseport_lb_test.c
+++ b/tests/sys/netinet/so_reuseport_lb_test.c
@@ -375,6 +375,11 @@ ATF_TC_BODY(concurrent_add, tc)
 
 		usleep(20000);
 	}
+
+	for (size_t j = nitems(threads); j > 0; j--) {
+		ATF_REQUIRE(pthread_cancel(threads[j - 1]) == 0);
+		ATF_REQUIRE(pthread_join(threads[j - 1], NULL) == 0);
+	}
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510072107.597L7Fmr006474>