Page MenuHomePhabricator

DifferentialChangesSinceLastUpdateField may fail policy checks and prevent mail from sending
Closed, ResolvedPublic

Description

We have a daemon task which is consistently failing (it has failing 1721) times. Attempting to execute the worker task manually provides the following error:

> ./bin/worker execute --id 20987313
Executing task 20987313 (PhabricatorApplicationTransactionPublishWorker)...
[2015-11-26 10:59:21] EXCEPTION: (PhabricatorPolicyException) [You Shall Not Pass: Restricted Differential Diff] (Can View) You do not have permission to view this object. // Subscribers can take this action. This diff is attached to a revision, and inherits its policies. at [<phabricator>/src/applications/policy/filter/PhabricatorPolicyFilter.php:590]
arcanist(head=master, ref.master=eeaa176cfc5a), phabricator(head=master, ref.master=b21928599960, custom=1), phlab(head=master, ref.master=cae356731a58), phutil(head=master, ref.master=f0881b37049c)
  #0 PhabricatorPolicyFilter::rejectObject(DifferentialDiff, string, string) called at [<phabricator>/src/applications/policy/filter/PhabricatorPolicyFilter.php:507]
  #1 PhabricatorPolicyFilter::checkCapability(DifferentialDiff, string) called at [<phabricator>/src/applications/policy/filter/PhabricatorPolicyFilter.php:214]
  #2 PhabricatorPolicyFilter::apply(array) called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:244]
  #3 PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:167]
  #4 PhabricatorPolicyAwareQuery::executeOne() called at [<phabricator>/src/applications/differential/customfield/DifferentialChangesSinceLastUpdateField.php:43]
  #5 DifferentialChangesSinceLastUpdateField::updateTransactionMailBody(PhabricatorMetaMTAMailBody, DifferentialTransactionEditor, array) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2681]
  #6 PhabricatorApplicationTransactionEditor::addCustomFieldsToMailBody(PhabricatorMetaMTAMailBody, DifferentialRevision, array) called at [<phabricator>/src/applications/differential/editor/DifferentialTransactionEditor.php:1227]
  #7 DifferentialTransactionEditor::buildMailBody(DifferentialRevision, array) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2376]
  #8 PhabricatorApplicationTransactionEditor::buildMailForTarget(DifferentialRevision, array, PhabricatorMailTarget) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2333]
  #9 PhabricatorApplicationTransactionEditor::buildMail(DifferentialRevision, array) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1048]
  #10 PhabricatorApplicationTransactionEditor::publishTransactions(DifferentialRevision, array) called at [<phabricator>/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php:21]
  #11 PhabricatorApplicationTransactionPublishWorker::doWork() called at [<phabricator>/src/infrastructure/daemon/workers/PhabricatorWorker.php:122]
  #12 PhabricatorWorker::executeTask() called at [<phabricator>/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php:171]
  #13 PhabricatorWorkerActiveTask::executeTask() called at [<phabricator>/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementExecuteWorkflow.php:52]
  #14 PhabricatorWorkerManagementExecuteWorkflow::execute(PhutilArgumentParser) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:406]
  #15 PhutilArgumentParser::parseWorkflowsFull(array) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:301]
  #16 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/scripts/setup/manage_worker.php:21]

Event Timeline

joshuaspence raised the priority of this task from to Needs Triage.
joshuaspence updated the task description. (Show Details)
joshuaspence added a subscriber: joshuaspence.

Some more information:

mysql> SELECT * FROM phabricator_worker.worker_activetask WHERE id = 20987313;
+----------+------------------------------------------------+--------------------------------------+--------------+--------------+----------+-------------+----------+--------------------------------+
| id       | taskClass                                      | leaseOwner                           | leaseExpires | failureCount | dataID   | failureTime | priority | objectPHID                     |
+----------+------------------------------------------------+--------------------------------------+--------------+--------------+----------+-------------+----------+--------------------------------+
| 20987313 | PhabricatorApplicationTransactionPublishWorker | 15432:144
+----------+------------------------------------------------+--------------------------------------+--------------+--------------+----------+-------------+----------+--------------------------------+

mysql> SELECT * FROM phabricator_differential.differential_revision WHERE phid = 'PHID-DREV-iwgsysq6uga2pctc5ega' \G
*************************** 1. row ***************************
              id: 28006
           title: REDACTED
   originalTitle: REDACTED
            phid: PHID-DREV-iwgsysq6uga2pctc5ega
          status: 5
         summary: REDACTED
        testPlan: REDACTED
      authorPHID: PHID-USER-4exe2zqemjerrra5hunl
lastReviewerPHID: NULL
       lineCount: 396
     dateCreated: 1447804930
    dateModified: 1448322631
        attached: []
         mailKey: hd7f4dbkreikhlno3u7rlkqhlnmsyvsrwmdzybp6
      branchName: NULL
      viewPolicy: obj.subscriptions.subscribers
      editPolicy: users
  repositoryPHID: PHID-REPO-yqvcpfiegflmjjci7vbu
1 row in set (0.00 sec)
epriestley renamed this task from Perpetually failing daemon task to DifferentialChangesSinceLastUpdateField may fail policy checks and prevent mail from sending.Dec 3 2015, 2:50 PM
epriestley triaged this task as Low priority.

It would be helpful to understand how to reproduce this. Specifically, I think what's happening is something like this:

  • Update a revision with a diff belonging to rSECRET.
  • Land the revision to rPUBLIC.
  • A Herald rule adds @alice as a CC in response to the revision closing?
  • @alice can see rPUBLIC, but can not see rSECRET. So she can see the revision and the commit, but can not see the older diff?

But it may be more complicated because I think that actually shouldn't matter and once the diff is attached to a revision.

The fix may be something like D13319, but we should understand how to reproduce this state first, because I might be way off in the guess above.

I'll see if I can come up with a reproduction case.

epriestley claimed this task.

I think it is likely that this was resolved by D17123. If it wasn't, we don't have a reproduction case anyway so we can't move forward. I'm going to call this one dead until more information turns up.