Skip to content

Commit 959a835

Browse files
author
epriestley
committedMay 22, 2020
When executing a repository passthru command via CommandEngine, don't set a timeout
Summary: Ref T13541. The passthru future does not have time limit behavior, so if we reach this code we currently fail. Phabricator never reaches this code normally, but this code is reachable during debugging if you try to foreground a slow fetch to inspect it. Passthru commands generally only make sense to run interactively, and the caller or control script can enforce their own timeouts (usually by pressing "^C" with their fingers). Test Plan: Used a debugging script to run ref-by-ref fetches in the foreground. Maniphest Tasks: T13541 Differential Revision: https://secure.phabricator.com/D21284
1 parent 4fd0628 commit 959a835

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎src/applications/diffusion/protocol/DiffusionCommandEngine.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,15 @@ public function getSudoAsDaemon() {
120120
public function newFuture() {
121121
$argv = $this->newCommandArgv();
122122
$env = $this->newCommandEnvironment();
123+
$is_passthru = $this->getPassthru();
123124

124125
if ($this->getSudoAsDaemon()) {
125126
$command = call_user_func_array('csprintf', $argv);
126127
$command = PhabricatorDaemon::sudoCommandAsDaemonUser($command);
127128
$argv = array('%C', $command);
128129
}
129130

130-
if ($this->getPassthru()) {
131+
if ($is_passthru) {
131132
$future = newv('PhutilExecPassthru', $argv);
132133
} else {
133134
$future = newv('ExecFuture', $argv);
@@ -139,7 +140,9 @@ public function newFuture() {
139140
// to try to avoid cases where `git fetch` hangs for some reason and we're
140141
// left sitting with a held lock forever.
141142
$repository = $this->getRepository();
142-
$future->setTimeout($repository->getEffectiveCopyTimeLimit());
143+
if (!$is_passthru) {
144+
$future->setTimeout($repository->getEffectiveCopyTimeLimit());
145+
}
143146

144147
return $future;
145148
}

0 commit comments

Comments
 (0)
Failed to load comments.