•  
      request #42262 PHP fatal error when processing async notifications
    Infos
    #42262
    Joris MASSON (jmasson)
    2025-03-25 14:30
    2025-03-25 11:47
    43938
    Details
    PHP fatal error when processing async notifications

    Follow-up of request #42238\

    There is a crash when sending e-mail notifications asynchronously. It is due to $server['REQUEST_URI'] which is accessed, but does not exist in asynchronous (CLI) code. It only happens for trackers that have a parent in hierarchy. For example Task child of User Story tracker, when you create or edit a Task artifact, the crash will occur.

    Introduced by git #tuleap/stable/1e4c86376e0e69b62d4f59f3cfd150538aa2c8f9

    Stack trace:

    Failed to successfully process an async event (Tuleap\Queue\WorkerEventContent Object
    (
        [event_name] => tuleap.tracker.artifact
        [payload] => Array
            (
                [artifact_id] => 114269
                [changeset_id] => 563435
                [mentioned_user_ids] => Array
                    (
                    )
    
                [send_notifications] => 1
            )
    
    )
    ): The command "'tuleap' 'queue:task-worker-process'" failed.
    
    Exit Code: 255(Unknown error)
    
    Working directory: /usr/share/tuleap/src/common/Queue/TaskWorker/../../../../
    
    Output:
    ================
    
    
    Error Output:
    ================
    PHP Warning:  Undefined array key "REQUEST_URI" in /usr/share/tuleap/src/common/include/URLVerification.php on line 398
    PHP Fatal error:  Uncaught TypeError: Tuleap\Project\RestrictedUserCanAccessUrlOrProjectVerifier::__construct(): Argument #3 ($request_uri) must be of type string, null given, called in /usr/share/tuleap/src/common/include/URLVerification.php on line 395 and defined in /usr/share/tuleap/src/common/Project/RestrictedUserCanAccessUrlOrProjectVerifier.php:47
    Stack trace:
    #0 /usr/share/tuleap/src/common/include/URLVerification.php(395): Tuleap\Project\RestrictedUserCanAccessUrlOrProjectVerifier->__construct()
    #1 /usr/share/tuleap/plugins/tracker/include/Tracker/Permission/TrackersPermissionsRetriever.php(309): URLVerification->userCanAccessProject()
    #2 /usr/share/tuleap/plugins/tracker/include/Tracker/Permission/TrackersPermissionsRetriever.php(149): Tuleap\Tracker\Permission\TrackersPermissionsRetriever->userCanAccessProject()
    #3 /usr/share/tuleap/plugins/tracker/include/Tracker/Permission/TrackersPermissionsRetriever.php(128): Tuleap\Tracker\Permission\TrackersPermissionsRetriever->buildTrackerViewPermissions()
    #4 /usr/share/tuleap/plugins/tracker/include/REST/TrackerRestBuilder.php(114): Tuleap\Tracker\Permission\TrackersPermissionsRetriever->retrieveUserPermissionOnTrackers()
    #5 /usr/share/tuleap/src/common/Option/Option.php(157): Tracker_REST_TrackerRestBuilder->{closure}()
    #6 /usr/share/tuleap/src/common/Option/Option.php(128): Tuleap\Option\Option->mapOr()
    #7 /usr/share/tuleap/plugins/tracker/include/REST/TrackerRestBuilder.php(113): Tuleap\Option\Option->andThen()
    #8 /usr/share/tuleap/plugins/tracker/include/REST/TrackerRestBuilder.php(77): Tracker_REST_TrackerRestBuilder->getParentTrackerUserCanRead()
    #9 /usr/share/tuleap/plugins/tracker/include/REST/TrackerRestBuilder.php(51): Tracker_REST_TrackerRestBuilder->buildTrackerRepresentation()
    #10 /usr/share/tuleap/plugins/tracker/include/Tracker/Webhook/ArtifactPayloadBuilder.php(73): Tracker_REST_TrackerRestBuilder->getTrackerRepresentationInTrackerContext()
    #11 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/WebhookNotificationTask.php(68): Tuleap\Tracker\Webhook\ArtifactPayloadBuilder->buildPayload()
    #12 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/ActionsRunner.php(264): Tuleap\Tracker\Artifact\Changeset\PostCreation\WebhookNotificationTask->execute()
    #13 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/ActionsRunner.php(258): Tuleap\Tracker\Artifact\Changeset\PostCreation\ActionsRunner->processPostCreationActions()
    #14 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/AsynchronousActionsRunner.php(90): Tuleap\Tracker\Artifact\Changeset\PostCreation\ActionsRunner->processAsyncPostCreationActions()
    #15 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/AsynchronousActionsRunner.php(48): Tuleap\Tracker\Artifact\Changeset\PostCreation\AsynchronousActionsRunner->process()
    #16 /usr/share/tuleap/plugins/tracker/include/trackerPlugin.php(1861): Tuleap\Tracker\Artifact\Changeset\PostCreation\AsynchronousActionsRunner::addListener()
    #17 /usr/share/tuleap/src/common/Event/EventManager.php(128): trackerPlugin->workerEvent()
    #18 /usr/share/tuleap/src/common/Plugin/PluginLoader.php(72): EventManager->eventManagerDispatch()
    #19 /usr/share/tuleap/src/common/Event/EventManager.php(117): Tuleap\Plugin\PluginLoader->Tuleap\Plugin\{closure}()
    #20 /usr/share/tuleap/src/common/Event/EventManager.php(147): EventManager->processEventOnListener()
    #21 /usr/share/tuleap/src/common/Queue/TaskWorker/TaskWorkerProcessCommand.php(78): EventManager->dispatch()
    #22 /usr/share/tuleap/src/common/Option/Option.php(103): Tuleap\Queue\TaskWorker\TaskWorkerProcessCommand->Tuleap\Queue\TaskWorker\{closure}()
    #23 /usr/share/tuleap/src/common/Queue/TaskWorker/TaskWorkerProcessCommand.php(76): Tuleap\Option\Option->match()
    #24 /usr/share/tuleap/src/vendor/symfony/console/Command/Command.php(279): Tuleap\Queue\TaskWorker\TaskWorkerProcessCommand->execute()
    #25 /usr/share/tuleap/src/vendor/symfony/console/Application.php(1076): Symfony\Component\Console\Command\Command->run()
    #26 /usr/share/tuleap/src/vendor/symfony/console/Application.php(342): Symfony\Component\Console\Application->doRunCommand()
    #27 /usr/share/tuleap/src/common/CLI/Application.php(76): Symfony\Component\Console\Application->doRun()
    #28 /usr/share/tuleap/src/vendor/symfony/console/Application.php(193): Tuleap\CLI\Application->doRun()
    #29 /usr/share/tuleap/src/utils/tuleap.php(347): Symfony\Component\Console\Application->run()
    #30 {main}
      thrown in /usr/share/tuleap/src/common/Project/RestrictedUserCanAccessUrlOrProjectVerifier.php on line 47
    
    
    {
      "host": "my.enalean.com",
      "metadata": {
        "tuleap": {
          "backtrace": "BrokerLogger->log src/vendor/psr/log/src/LoggerTrait.php:50\nPsr\\Log\\AbstractLogger->error src/common/Queue/DB/DBPersistentQueue.php:106\nTuleap\\Queue\\DB\\DBPersistentQueue->dealWithProcessingFailure src/common/Queue/DB/DBPersistentQueue.php:81\nTuleap\\Queue\\DB\\DBPersistentQueue->Tuleap\\Queue\\DB\\{closure} src/vendor/paragonie/easydb/src/EasyDB.php:1263\nParagonIE\\EasyDB\\EasyDB->tryFlatTransaction src/common/DB/DBTransactionExecutorWithConnection.php:44\nTuleap\\DB\\DBTransactionExecutorWithConnection->execute src/common/Queue/DB/DBPersistentQueue.php:63\nTuleap\\Queue\\DB\\DBPersistentQueue->listen src/common/Queue/Worker.php:85\nTuleap\\Queue\\Worker->listen src/common/Queue/Worker.php:73\nTuleap\\Queue\\Worker->main src/utils/worker.php:26\n",
          "call_type": "->",
          "classname": "BrokerLogger",
          "exception": {
            "class": "Symfony\\Component\\Process\\Exception\\ProcessFailedException",
            "code": 0,
            "file": "/usr/share/tuleap/src/common/Queue/TaskWorker/TaskWorkerProcess.php:73",
            "message": "The command \"'tuleap' 'queue:task-worker-process'\" failed.\n\nExit Code: 255(Unknown error)\n\nWorking directory: /usr/share/tuleap/src/common/Queue/TaskWorker/../../../../\n\nOutput:\n================\n\n\nError Output:\n================\nPHP Warning:  Undefined array key \"REQUEST_URI\" in /usr/share/tuleap/src/common/include/URLVerification.php on line 398\nPHP Fatal error:  Uncaught TypeError: Tuleap\\Project\\RestrictedUserCanAccessUrlOrProjectVerifier::__construct(): Argument #3 ($request_uri) must be of type string, null given, called in /usr/share/tuleap/src/common/include/URLVerification.php on line 395 and defined in /usr/share/tuleap/src/common/Project/RestrictedUserCanAccessUrlOrProjectVerifier.php:47\nStack trace:\n#0 /usr/share/tuleap/src/common/include/URLVerification.php(395): Tuleap\\Project\\RestrictedUserCanAccessUrlOrProjectVerifier->__construct()\n#1 /usr/share/tuleap/plugins/tracker/include/Tracker/Permission/TrackersPermissionsRetriever.php(309): URLVerification->userCanAccessProject()\n#2 /usr/share/tuleap/plugins/tracker/include/Tracker/Permission/TrackersPermissionsRetriever.php(149): Tuleap\\Tracker\\Permission\\TrackersPermissionsRetriever->userCanAccessProject()\n#3 /usr/share/tuleap/plugins/tracker/include/Tracker/Permission/TrackersPermissionsRetriever.php(128): Tuleap\\Tracker\\Permission\\TrackersPermissionsRetriever->buildTrackerViewPermissions()\n#4 /usr/share/tuleap/plugins/tracker/include/REST/TrackerRestBuilder.php(114): Tuleap\\Tracker\\Permission\\TrackersPermissionsRetriever->retrieveUserPermissionOnTrackers()\n#5 /usr/share/tuleap/src/common/Option/Option.php(157): Tracker_REST_TrackerRestBuilder->{closure}()\n#6 /usr/share/tuleap/src/common/Option/Option.php(128): Tuleap\\Option\\Option->mapOr()\n#7 /usr/share/tuleap/plugins/tracker/include/REST/TrackerRestBuilder.php(113): Tuleap\\Option\\Option->andThen()\n#8 /usr/share/tuleap/plugins/tracker/include/REST/TrackerRestBuilder.php(77): Tracker_REST_TrackerRestBuilder->getParentTrackerUserCanRead()\n#9 /usr/share/tuleap/plugins/tracker/include/REST/TrackerRestBuilder.php(51): Tracker_REST_TrackerRestBuilder->buildTrackerRepresentation()\n#10 /usr/share/tuleap/plugins/tracker/include/Tracker/Webhook/ArtifactPayloadBuilder.php(73): Tracker_REST_TrackerRestBuilder->getTrackerRepresentationInTrackerContext()\n#11 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/WebhookNotificationTask.php(68): Tuleap\\Tracker\\Webhook\\ArtifactPayloadBuilder->buildPayload()\n#12 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/ActionsRunner.php(264): Tuleap\\Tracker\\Artifact\\Changeset\\PostCreation\\WebhookNotificationTask->execute()\n#13 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/ActionsRunner.php(258): Tuleap\\Tracker\\Artifact\\Changeset\\PostCreation\\ActionsRunner->processPostCreationActions()\n#14 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/AsynchronousActionsRunner.php(90): Tuleap\\Tracker\\Artifact\\Changeset\\PostCreation\\ActionsRunner->processAsyncPostCreationActions()\n#15 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/AsynchronousActionsRunner.php(48): Tuleap\\Tracker\\Artifact\\Changeset\\PostCreation\\AsynchronousActionsRunner->process()\n#16 /usr/share/tuleap/plugins/tracker/include/trackerPlugin.php(1861): Tuleap\\Tracker\\Artifact\\Changeset\\PostCreation\\AsynchronousActionsRunner::addListener()\n#17 /usr/share/tuleap/src/common/Event/EventManager.php(128): trackerPlugin->workerEvent()\n#18 /usr/share/tuleap/src/common/Plugin/PluginLoader.php(72): EventManager->eventManagerDispatch()\n#19 /usr/share/tuleap/src/common/Event/EventManager.php(117): Tuleap\\Plugin\\PluginLoader->Tuleap\\Plugin\\{closure}()\n#20 /usr/share/tuleap/src/common/Event/EventManager.php(147): EventManager->processEventOnListener()\n#21 /usr/share/tuleap/src/common/Queue/TaskWorker/TaskWorkerProcessCommand.php(78): EventManager->dispatch()\n#22 /usr/share/tuleap/src/common/Option/Option.php(103): Tuleap\\Queue\\TaskWorker\\TaskWorkerProcessCommand->Tuleap\\Queue\\TaskWorker\\{closure}()\n#23 /usr/share/tuleap/src/common/Queue/TaskWorker/TaskWorkerProcessCommand.php(76): Tuleap\\Option\\Option->match()\n#24 /usr/share/tuleap/src/vendor/symfony/console/Command/Command.php(279): Tuleap\\Queue\\TaskWorker\\TaskWorkerProcessCommand->execute()\n#25 /usr/share/tuleap/src/vendor/symfony/console/Application.php(1076): Symfony\\Component\\Console\\Command\\Command->run()\n#26 /usr/share/tuleap/src/vendor/symfony/console/Application.php(342): Symfony\\Component\\Console\\Application->doRunCommand()\n#27 /usr/share/tuleap/src/common/CLI/Application.php(76): Symfony\\Component\\Console\\Application->doRun()\n#28 /usr/share/tuleap/src/vendor/symfony/console/Application.php(193): Tuleap\\CLI\\Application->doRun()\n#29 /usr/share/tuleap/src/utils/tuleap.php(347): Symfony\\Component\\Console\\Application->run()\n#30 {main}\n  thrown in /usr/share/tuleap/src/common/Project/RestrictedUserCanAccessUrlOrProjectVerifier.php on line 47\n",
            "trace": [
              "/usr/share/tuleap/src/common/Queue/Worker.php:89",
              "/usr/share/tuleap/src/common/Queue/DB/DBPersistentQueue.php:77",
              "/usr/share/tuleap/src/vendor/paragonie/easydb/src/EasyDB.php:1263",
              "/usr/share/tuleap/src/common/DB/DBTransactionExecutorWithConnection.php:44",
              "/usr/share/tuleap/src/common/Queue/DB/DBPersistentQueue.php:63",
              "/usr/share/tuleap/src/common/Queue/Worker.php:85",
              "/usr/share/tuleap/src/common/Queue/Worker.php:73",
              "/usr/share/tuleap/src/utils/worker.php:26"
            ]
          },
          "facility": "worker_log",
          "file": "/usr/share/tuleap/src/common/Log/BrokerLogger.php",
          "function": "log",
          "level": "err",
          "line_number": 40,
          "version": "16.5.99.194-1"
        },
        "vector": {
          "ingest_timestamp": "2025-03-25T10:01:35.621326042Z",
          "source_type": "socket"
        }
      }
    }
    
    Trackers
    development
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Joris MASSON (jmasson)
    Closed
    2025-03-25
    Attachments
    Empty
    References

    Follow-ups

    User avatar
    Joris MASSON (jmasson)2025-03-25 14:25
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes