Skip to content

Commit 4257b26

Browse files
author
epriestley
committed
Treat PHP7 "Throwable" exceptions like other unhandled "Exception" cases in the worker queue
Summary: See PHI1745. Under PHP7, errors raised as Throwable miss this "generic exception" logic and don't increment their failure count. Instead, treat any "Throwable" we don't recognize like any "Exception" we don't recognize. Test Plan: - Under PHP7, caused a worker task to raise a Throwable (e.g., call to undefined method, see D21270). - Ran `bin/worker execute --id ...`. - Before: worker failed, but did not increment failure count. - After: worker fails and increments failure count as it would for other types of unknown error. Differential Revision: https://secure.phabricator.com/D21271
1 parent 43a8d87 commit 4257b26

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public function executeTask() {
134134

135135
$did_succeed = false;
136136
$worker = null;
137+
$caught = null;
137138
try {
138139
$worker = $this->getWorkerInstance();
139140
$worker->setCurrentWorkerTask($this);
@@ -180,6 +181,12 @@ public function executeTask() {
180181

181182
$result = $this;
182183
} catch (Exception $ex) {
184+
$caught = $ex;
185+
} catch (Throwable $ex) {
186+
$caught = $ex;
187+
}
188+
189+
if ($caught) {
183190
$this->setExecutionException($ex);
184191
$this->setFailureCount($this->getFailureCount() + 1);
185192
$this->setFailureTime(time());

src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function getConfiguration() {
3434
) + parent::getConfiguration();
3535
}
3636

37-
final public function setExecutionException(Exception $execution_exception) {
37+
final public function setExecutionException($execution_exception) {
3838
$this->executionException = $execution_exception;
3939
return $this;
4040
}

0 commit comments

Comments
 (0)