Commit 4257b26a authored by epriestley's avatar epriestley
Browse files

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
parent 43a8d876
......@@ -134,6 +134,7 @@ final class PhabricatorWorkerActiveTask extends PhabricatorWorkerTask {
$did_succeed = false;
$worker = null;
$caught = null;
try {
$worker = $this->getWorkerInstance();
$worker->setCurrentWorkerTask($this);
......@@ -180,6 +181,12 @@ final class PhabricatorWorkerActiveTask extends PhabricatorWorkerTask {
$result = $this;
} catch (Exception $ex) {
$caught = $ex;
} catch (Throwable $ex) {
$caught = $ex;
}
if ($caught) {
$this->setExecutionException($ex);
$this->setFailureCount($this->getFailureCount() + 1);
$this->setFailureTime(time());
......
......@@ -34,7 +34,7 @@ abstract class PhabricatorWorkerTask extends PhabricatorWorkerDAO {
) + parent::getConfiguration();
}
final public function setExecutionException(Exception $execution_exception) {
final public function setExecutionException($execution_exception) {
$this->executionException = $execution_exception;
return $this;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment