@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Send permanent dameon failures to the log, even when not running in verbose mode

Summary:
Fixes T12803. An install is having difficulty diagnosing mail failures, and one component is that permanent task failures aren't reaching the log.

It's reasonable to send these to the log even when "phd.verbose" is off. See T12803 for a rough review of when we generate these failrues today.

Test Plan:
- Faked some exceptions.
- Got a result in the log (P2058) with `phd.verbose` turned off.

Reviewers: chad, amckinley

Reviewed By: chad

Maniphest Tasks: T12803

Differential Revision: https://secure.phabricator.com/D18106

+20 -9
+12 -5
src/applications/metamta/PhabricatorMetaMTAWorker.php
··· 13 13 14 14 protected function doWork() { 15 15 $message = $this->loadMessage(); 16 - if (!$message) { 17 - throw new PhabricatorWorkerPermanentFailureException( 18 - pht('Unable to load message!')); 19 - } 20 16 21 17 if ($message->getStatus() != PhabricatorMailOutboundStatus::STATUS_QUEUE) { 22 18 return; ··· 32 28 33 29 private function loadMessage() { 34 30 $message_id = $this->getTaskData(); 35 - return id(new PhabricatorMetaMTAMail())->load($message_id); 31 + $message = id(new PhabricatorMetaMTAMail()) 32 + ->load($message_id); 33 + 34 + if (!$message) { 35 + throw new PhabricatorWorkerPermanentFailureException( 36 + pht( 37 + 'Unable to load mail message (with ID "%s") while preparing to '. 38 + 'deliver it.', 39 + $message_id)); 40 + } 41 + 42 + return $message; 36 43 } 37 44 38 45 public function renderForDisplay(PhabricatorUser $viewer) {
+8 -4
src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php
··· 23 23 $ex = $task->getExecutionException(); 24 24 if ($ex) { 25 25 if ($ex instanceof PhabricatorWorkerPermanentFailureException) { 26 - $this->log( 26 + // NOTE: Make sure these reach the daemon log, even when not 27 + // running in "phd.verbose" mode. See T12803 for discussion. 28 + $log_exception = new PhutilProxyException( 27 29 pht( 28 - 'Task %d was cancelled: %s', 29 - $id, 30 - $ex->getMessage())); 30 + 'Task "%s" encountered a permanent failure and was '. 31 + 'cancelled.', 32 + $id), 33 + $ex); 34 + phlog($log_exception); 31 35 } else if ($ex instanceof PhabricatorWorkerYieldException) { 32 36 $this->log(pht('Task %s yielded.', $id)); 33 37 } else {