diff -Nru iperf-2.0.10+dfsg1/debian/changelog iperf-2.0.10+dfsg1/debian/changelog --- iperf-2.0.10+dfsg1/debian/changelog 2018-06-05 16:48:25.000000000 +0000 +++ iperf-2.0.10+dfsg1/debian/changelog 2019-06-17 19:16:49.000000000 +0000 @@ -1,3 +1,12 @@ +iperf (2.0.10+dfsg1-1ubuntu0.18.04.2) bionic; urgency=medium + + * Add backlog_increase.patch to fix hangs and connection resets + with high thread count. LP: #1832399. + * Add signal_bug.patch to fix issue with the server not exiting + via SIGINT. LP: #1832401. + + -- dann frazier Mon, 17 Jun 2019 13:16:49 -0600 + iperf (2.0.10+dfsg1-1ubuntu0.18.04.1) bionic; urgency=medium * fix for: iperf2 long time run on 40Gb/s NIC crashes (LP: #1771283) diff -Nru iperf-2.0.10+dfsg1/debian/patches/backlog_increase.patch iperf-2.0.10+dfsg1/debian/patches/backlog_increase.patch --- iperf-2.0.10+dfsg1/debian/patches/backlog_increase.patch 1970-01-01 00:00:00.000000000 +0000 +++ iperf-2.0.10+dfsg1/debian/patches/backlog_increase.patch 2019-06-17 19:16:22.000000000 +0000 @@ -0,0 +1,32 @@ +From: Robert McMahon +Subject: [PATCH] increase listen backlog limit to much larger value +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930386 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1832399 +Last-Update: 2019-06-11 +Applied-Upstream: https://sourceforge.net/p/iperf2/code/ci/4565c2ce318318a8a1d4578bab78c0e03fb49437/ +[ dannf: Removed incidental version number changes from commit ] + +Index: iperf-2.0.10+dfsg1/src/Listener.cpp +=================================================================== +--- iperf-2.0.10+dfsg1.orig/src/Listener.cpp ++++ iperf-2.0.10+dfsg1/src/Listener.cpp +@@ -73,6 +73,7 @@ + + #define HEADERS() + ++#include + #include "headers.h" + #include "Listener.hpp" + #include "SocketAddr.h" +@@ -367,9 +368,9 @@ void Listener::Listen( ) { + FAIL_errno( rc == SOCKET_ERROR, "bind", mSettings ); + } + // listen for connections (TCP only). +- // default backlog traditionally 5 ++ // use large (INT_MAX) backlog allowing multiple simultaneous connections + if ( !isUDP( mSettings ) ) { +- rc = listen( mSettings->mSock, 5 ); ++ rc = listen( mSettings->mSock, INT_MAX ); + WARN_errno( rc == SOCKET_ERROR, "listen" ); + } + diff -Nru iperf-2.0.10+dfsg1/debian/patches/series iperf-2.0.10+dfsg1/debian/patches/series --- iperf-2.0.10+dfsg1/debian/patches/series 2018-06-05 16:48:25.000000000 +0000 +++ iperf-2.0.10+dfsg1/debian/patches/series 2019-06-17 19:16:22.000000000 +0000 @@ -6,3 +6,5 @@ 016-configure-fix-unsetting--g 017-fix-32b-constat.patch 018-fix-for-iperf2-long-time-run-on-40Gb-s-NIC-crashes-f.patch +backlog_increase.patch +signal_bug.patch diff -Nru iperf-2.0.10+dfsg1/debian/patches/signal_bug.patch iperf-2.0.10+dfsg1/debian/patches/signal_bug.patch --- iperf-2.0.10+dfsg1/debian/patches/signal_bug.patch 1970-01-01 00:00:00.000000000 +0000 +++ iperf-2.0.10+dfsg1/debian/patches/signal_bug.patch 2019-06-17 19:16:22.000000000 +0000 @@ -0,0 +1,50 @@ +From: Robert McMahon +Subject: [PATCH] fix latent bug in signal handling, per POSIX calling exit() + in signal handler is not safe. Use _exit() instead. Also, detect the user + signal SIGINT for the case of server needing two invocations to stop server + threads. Note: the server threads still need some work from graceful + termination with a single ctrl-c +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930390 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1832401 +Last-Update: 2019-06-11 +Applied-Upstream: https://sourceforge.net/p/iperf2/code/ci/7c0ac64ebea38d0d9ff4d160db4d33bc087a3490/ + +diff --git a/compat/signal.c b/compat/signal.c +index 92ddc25..48a0f9d 100644 +--- a/compat/signal.c ++++ b/compat/signal.c +@@ -171,7 +171,7 @@ void sig_exit( int inSigno ) { + static int num = 0; + if ( num++ == 0 ) { + fflush( 0 ); +- exit( 0 ); ++ _exit(0); + } + } /* end sig_exit */ + +diff --git a/src/main.cpp b/src/main.cpp +index 53069fd..2a70e8e 100644 +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -268,7 +268,7 @@ void Sig_Interupt( int inSigno ) { + // We try to not allow a single interrupt handled by multiple threads + // to completely kill the app so we save off the first thread ID + // then that is the only thread that can supply the next interrupt +- if ( thread_equalid( sThread, thread_zeroid() ) ) { ++ if ( (inSigno == SIGINT) && thread_equalid( sThread, thread_zeroid() ) ) { + sThread = thread_getid(); + } else if ( thread_equalid( sThread, thread_getid() ) ) { + sig_exit( inSigno ); +@@ -420,9 +420,3 @@ VOID ServiceStop() { + } + + #endif +- +- +- +- +- +- +-- +2.20.1 +