Fix a deadlock leading to a hang in -R mode.

In -R mode, the test consists of the server sending to the client
until the client tells it to stop by setting the test state to
TEST_END via the control socket.  However once the client changes the
test state, it stopped reading the incoming test data from the server.
In many (but not all) scenarios this could result in the server
filling up its send window (thus blocking on writes) before the
TEST_END message arrived from the client.  At this point the server
was hanging waiting for the client to drain its data connection(s),
and the client was waiting for the server to send a state change
message for EXCHANGE_RESULTS.

Bump copyright date while here.

This fix handles at least part of...

Issue:		129 (iperf3 hangs with -R and -Z flags)
This commit is contained in:
Bruce A. Mah 2014-01-03 10:06:16 -08:00
parent 48e66b9b9a
commit 0fdda50c64

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2011, The Regents of the University of California,
* Copyright (c) 2009-2014, The Regents of the University of California,
* through Lawrence Berkeley National Laboratory (subject to receipt of any
* required approvals from the U.S. Dept. of Energy). All rights reserved.
*
@ -450,6 +450,15 @@ iperf_run_client(struct iperf_test * test)
}
}
}
// If we're in reverse mode, continue draining the data
// connection(s) even if test is over. This prevents a
// deadlock where the server side fills up its pipe(s)
// and gets blocked, so it can't receive state changes
// from the client side.
else if (test->reverse && test->state == TEST_END) {
if (iperf_recv(test, &read_set) < 0)
return -1;
}
}
if (test->json_output) {