1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Drain stderr during test process execution as well as termination to prevent lockups if there is a lot of output.

This commit is contained in:
David Steele 2017-08-11 18:31:25 -04:00
parent f8de73674c
commit 4331e09376
2 changed files with 16 additions and 4 deletions

View File

@ -169,6 +169,10 @@
<release-item>
<p>Changed log test order to ignore unimportant log errors while shutting down <postgres/>.</p>
</release-item>
<release-item>
<p>Drain <id>stderr</id> during test process execution as well as termination to prevent lockups if there is a lot of output.</p>
</release-item>
</release-bug-list>
<release-refactor-list>

View File

@ -99,9 +99,13 @@ sub begin
$self->{pId} = open3(undef, $self->{hOut}, $self->{hError}, $self->{strCommand});
# Create select objects
# Create buffered read object
$self->{oIo} = new pgBackRest::Common::Io::Buffered(new pgBackRest::Common::Io::Handle('exec test', $self->{hOut}), 0, 65536);
# Create buffered error object
$self->{oIoError} = new pgBackRest::Common::Io::Buffered(
new pgBackRest::Common::Io::Handle('exec test', $self->{hError}), 0, 65536);
# Record start time and set process timeout
$self->{iProcessTimeout} = 540;
$self->{lTimeLast} = time();
@ -167,6 +171,12 @@ sub endRetry
}
}
# Drain the stderr stream
while (defined(my $strLine = $self->{oIoError}->readLine(true, false)))
{
$self->{strErrorLog} .= "${strLine}\n";
}
if (!$bWait)
{
return;
@ -193,9 +203,7 @@ sub endRetry
}
# Drain the stderr stream
my $oIoError = new pgBackRest::Common::Io::Buffered(new pgBackRest::Common::Io::Handle('exec test', $self->{hError}), 0, 65536);
while (defined(my $strLine = $oIoError->readLine(true, false)))
while (defined(my $strLine = $self->{oIoError}->readLine(true, false)))
{
$self->{strErrorLog} .= "${strLine}\n";
}