From 63f83c3fb6fe7e32777b29fa229481b8a21c2235 Mon Sep 17 00:00:00 2001 From: DavidBar-On Date: Fri, 21 Mar 2025 11:37:35 +0200 Subject: [PATCH 1/4] Print an error message when a Worker (Send/Receive) Thread fail --- src/iperf_client_api.c | 1 + src/iperf_server_api.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index 23ca67f61..7c3c6ee75 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -93,6 +93,7 @@ iperf_client_worker_run(void *s) { return NULL; cleanup_and_fail: + iperf_err(test, "Client Worker Thread failed - %s, with errno %s (%d)", iperf_strerror(i_errno), strerror(errno), errno); return NULL; } diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 66401fa6b..33e1c066e 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -106,6 +106,7 @@ iperf_server_worker_run(void *s) { return NULL; cleanup_and_fail: + iperf_err(test, "Server Worker Thread failed - %s, with errno %s (%d)", iperf_strerror(i_errno), strerror(errno), errno); return NULL; } From 168789bf7304b8c93ba97bc2ae5a460ee4c6dea3 Mon Sep 17 00:00:00 2001 From: DavidBar-On Date: Fri, 21 Mar 2025 16:56:12 +0200 Subject: [PATCH 2/4] Remove second print of errno value --- src/iperf_client_api.c | 2 +- src/iperf_server_api.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index 7c3c6ee75..7242c27c2 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -93,7 +93,7 @@ iperf_client_worker_run(void *s) { return NULL; cleanup_and_fail: - iperf_err(test, "Client Worker Thread failed - %s, with errno %s (%d)", iperf_strerror(i_errno), strerror(errno), errno); + iperf_err(test, "Client Worker Thread failed - %s", iperf_strerror(i_errno)); return NULL; } diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 33e1c066e..755eb585d 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -106,7 +106,7 @@ iperf_server_worker_run(void *s) { return NULL; cleanup_and_fail: - iperf_err(test, "Server Worker Thread failed - %s, with errno %s (%d)", iperf_strerror(i_errno), strerror(errno), errno); + iperf_err(test, "Server Worker Thread failed - %s", iperf_strerror(i_errno)); return NULL; } From 85b256763e7c39b5700adb632d72925039ae5546 Mon Sep 17 00:00:00 2001 From: DavidBar-On Date: Fri, 23 Jan 2026 21:48:49 +0200 Subject: [PATCH 3/4] Print the error message only if socket was not closed already and flush the message --- src/iperf_client_api.c | 5 ++++- src/iperf_server_api.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index 7242c27c2..a5bf5e970 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -93,7 +93,10 @@ iperf_client_worker_run(void *s) { return NULL; cleanup_and_fail: - iperf_err(test, "Client Worker Thread failed - %s", iperf_strerror(i_errno)); + if (test->ctrl_sck != -1) { // Make sure test was not cleared yet but the main thread + iperf_err(test, "Server Worker Thread failed - %s", iperf_strerror(i_errno)); + if (test->ctrl_sck != -1) iflush(test); + } return NULL; } diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 755eb585d..8a11af68e 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -106,7 +106,10 @@ iperf_server_worker_run(void *s) { return NULL; cleanup_and_fail: - iperf_err(test, "Server Worker Thread failed - %s", iperf_strerror(i_errno)); + if (test->ctrl_sck != -1) { // Make sure test was not cleared yet but the main thread + iperf_err(test, "Server Worker Thread failed - %s", iperf_strerror(i_errno)); + if (test->ctrl_sck != -1) iflush(test); + } return NULL; } From 17695f654c08cf313d978603ea82b6b494981446 Mon Sep 17 00:00:00 2001 From: DavidBar-On Date: Fri, 14 Aug 2026 12:59:35 +0300 Subject: [PATCH 4/4] Worker theread error is printed to NULL test to prevent adding JSON output context into the thread context --- src/iperf_client_api.c | 5 +++-- src/iperf_server_api.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index a5bf5e970..a5860fe53 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -93,8 +93,9 @@ iperf_client_worker_run(void *s) { return NULL; cleanup_and_fail: - if (test->ctrl_sck != -1) { // Make sure test was not cleared yet but the main thread - iperf_err(test, "Server Worker Thread failed - %s", iperf_strerror(i_errno)); + if (test->ctrl_sck != -1) { // Make sure test was not cleared yet by the main thread + // Error message is printed to NULL test to prevent adding JSON output context into the thread context + iperf_err(NULL, "Server Worker Thread failed - %s", iperf_strerror(i_errno)); if (test->ctrl_sck != -1) iflush(test); } return NULL; diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 8a11af68e..3637600cd 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -106,8 +106,9 @@ iperf_server_worker_run(void *s) { return NULL; cleanup_and_fail: - if (test->ctrl_sck != -1) { // Make sure test was not cleared yet but the main thread - iperf_err(test, "Server Worker Thread failed - %s", iperf_strerror(i_errno)); + if (test->ctrl_sck != -1) { // Make sure test was not cleared yet by the main thread + // Error message is printed to NULL test to prevent adding JSON output context into the thread context + iperf_err(NULL, "Server Worker Thread failed - %s", iperf_strerror(i_errno)); if (test->ctrl_sck != -1) iflush(test); } return NULL;