Page MenuHomePhorge

Renaming several Pholio Mockup images creates neverending daemon task (PhutilProxyException due to Array to string conversion)
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. PHP 8.2.10, Phorge at 91faf16cace9308440087d64f17c068e04313c50
  2. Run ./bin/phd restart
  3. Go to http://phorge.localhost/pholio/create/
  4. Upload 3 images at once and enter titles for them, save
  5. Go to http://phorge.localhost/pholio/edit/11/ to edit that Mock
  6. Rename all 3 image titles at once and click Save button
  7. Look into /var/tmp/phd/log/daemons.log and at "Leased Tasks" on http://phorge.localhost/daemon/

Outcome:

[2023-09-26 12:28:05] EXCEPTION: (PhutilProxyException) Error while executing Task ID 11635. {>} (RuntimeException) Array to string conversion at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=customOAuthUrlencodeNull, ref.master=df6c315ace5f, ref.customOAuthUrlencodeNull=c69b9749027f), phorge(head=master, ref.master=91faf16cace9)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> sprintf(string, array) called at [<phorge>/src/applications/transactions/storage/PhabricatorModularTransactionType.php:244]
  #2 <#2> PhabricatorModularTransactionType::renderValue(array) called at [<phorge>/src/applications/pholio/xaction/PholioImageNameTransaction.php:34]
  #3 <#2> PholioImageNameTransaction::getTitle() called at [<phorge>/src/applications/transactions/storage/PhabricatorModularTransaction.php:127]
  #4 <#2> PhabricatorModularTransaction::getTitle() called at [<phorge>/src/applications/transactions/storage/PhabricatorApplicationTransaction.php:845]
  #5 <#2> PhabricatorApplicationTransaction::getTitleForMail() called at [<phorge>/src/applications/transactions/storage/PhabricatorApplicationTransaction.php:835]
  #6 <#2> PhabricatorApplicationTransaction::getTitleForMailWithRenderingTarget(string) called at [<phorge>/src/applications/transactions/storage/PhabricatorApplicationTransaction.php:849]
  #7 <#2> PhabricatorApplicationTransaction::getTitleForTextMail() called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:5600]
  #8 <#2> PhabricatorApplicationTransactionEditor::getTitleForTextMail(PholioTransaction) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:3901]
  #9 <#2> PhabricatorApplicationTransactionEditor::addHeadersAndCommentsToMailBody(PhabricatorMetaMTAMailBody, array, string, string) called at [<phorge>/src/applications/pholio/editor/PholioMockEditor.php:72]
  #10 <#2> PholioMockEditor::buildMailBody(PholioMock, array) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:3538]
  #11 <#2> PhabricatorApplicationTransactionEditor::buildMailForTarget(PholioMock, array, PhabricatorMailTarget) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:3481]
  #12 <#2> PhabricatorApplicationTransactionEditor::buildMailWithRecipients(PholioMock, array, array, array, array) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:3419]
  #13 <#2> PhabricatorApplicationTransactionEditor::buildMail(PholioMock, array) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1677]
  #14 <#2> PhabricatorApplicationTransactionEditor::publishTransactions(PholioMock, array) called at [<phorge>/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php:21]
  #15 <#2> PhabricatorApplicationTransactionPublishWorker::doWork() called at [<phorge>/src/infrastructure/daemon/workers/PhabricatorWorker.php:124]
  #16 <#2> PhabricatorWorker::executeTask() called at [<phorge>/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php:160]
  #17 <#2> PhabricatorWorkerActiveTask::executeTask() called at [<phorge>/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php:22]
  #18 PhabricatorTaskmasterDaemon::run() called at [<phorge>/src/infrastructure/daemon/PhutilDaemon.php:219]
  #19 PhutilDaemon::execute() called at [<phorge>/scripts/daemon/exec/exec_daemon.php:131]

Upstreaming from https://phabricator.wikimedia.org/T347354 as I could reproduce locally.

Event Timeline

For interesting reasons, I cannot, in any way, get an email about somebody renaming a single Mockup photo. And, my email preferences are like "email me for everything from every application" and email delivery is "email me about myself".

Interestingly I was able to reproduce the issue with this nonsense patch, in the hope to emulate an email plain-text generation, even if it's not the case:

diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php
index e2f0a02239..c233aa13bc 100644
--- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php
+++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php
@@ -240,7 +240,7 @@ abstract class PhabricatorModularTransactionType
   }

   final protected function renderValue($value) {
-    if ($this->isTextMode()) {
+    if ($this->isTextMode() || true) {
       return sprintf('"%s"', $value);
     }