Skip to content

Commit

Permalink
Discard stdout/stderr from the aphlict subprocess when running in dae…
Browse files Browse the repository at this point in the history
…mon (normal) mode

Summary:
Fixes T11818. We don't discard output, so once we read more than 2GB of output we'll exceed the maximum size of a string in an internal buffer.

Instead, configure the future so output is discarded.

Test Plan: Added logging to `libphutil/`, saw internal buffer grow steadily before this change and stay constant at 0 after this change.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11818

Differential Revision: https://secure.phabricator.com/D16855
  • Loading branch information
epriestley committed Nov 14, 2016
1 parent 19c6ccb commit 7165e4d
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -416,6 +416,14 @@ final protected function launch() {
while (true) {
global $g_future;
$g_future = new ExecFuture('exec %C', $command);

// Discard all output the subprocess produces: it writes to the log on
// disk, so we don't need to send the output anywhere and can just
// throw it away.
$g_future
->setStdoutSizeLimit(0)
->setStderrSizeLimit(0);

$g_future->resolve();

// If the server exited, wait a couple of seconds and restart it.
Expand Down

0 comments on commit 7165e4d

Please sign in to comment.