Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 018632a

Browse files
committed
Fix race condition in TLSProxy
Normally TLSProxy waits for the s_server process to finish before continuing. However in cases where serverconnects > 1 we need to keep the s_server process around for a later test so we continue immediately. This means that TAP test output can end up being printed to stdout at the same time as s_server is printing stuff. This confuses the test runner and can cause spurious test failures. This commit introduces a small delay in cases where serverconnects > 1 in order to give s_server enough time to finish what it was doing before we continue to the next test. Fixes openssl#4129 Reviewed-by: Rich Salz <[email protected]> (Merged from openssl#4660)
1 parent 9f5671c commit 018632a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

util/perl/TLSProxy/Proxy.pm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use TLSProxy::Certificate;
2323
use TLSProxy::CertificateVerify;
2424
use TLSProxy::ServerKeyExchange;
2525
use TLSProxy::NewSessionTicket;
26+
use Time::HiRes qw/usleep/;
2627

2728
my $have_IPv6 = 0;
2829
my $IP_factory;
@@ -343,6 +344,9 @@ sub clientstart
343344
.$self->serverpid."\n";
344345
waitpid( $self->serverpid, 0);
345346
die "exit code $? from server process\n" if $? != 0;
347+
} else {
348+
# Give s_server sufficient time to finish what it was doing
349+
usleep(250000);
346350
}
347351
die "clientpid is zero\n" if $self->clientpid == 0;
348352
print "Waiting for client process to close: ".$self->clientpid."\n";

0 commit comments

Comments
 (0)