Review main Merged

87001[TASK] Add details to CLI scheduler:run exceptions

Philipp Kitzberger CR +2 V +2 Easy +12 −1 updated 11/22/24, 18:56

Commit message

This adds important information on a failed task to CLI so they're
automatically included in the mails that are being sent by the cron
daemon to MAILTO, as well as being emitted in the CLI output.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Philipp Kitzberger +1
    • Christian Kuhn +1
    • Christoph Lehmann +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Philipp Kitzberger +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 3442

Show 1317 earlier messages
  1. Philipp Kitzberger uploaded patch set 1 11/16/24, 10:34

  2. core-ci voted on patch set 1 V +1 11/16/24, 10:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69524

  3. Garvin Hicking commented on patch set 1 11/16/24, 12:01

    This looks promising, thank you! IMO it could be labelled as a task and probably also go to 13.4... (couldn't review/test yet but added it to my list for next week unless someone gets to it first)
  4. Mathias Brodala commented on patch set 1 11/18/24, 07:32

    SchedulerCommand.php:196

    This should be combined with the error message outputted afterwards. Said error should be the first thing to output since it's the most important bit. Debugging details can follow. But probably only if $this->io->isVerbose() or ->isDebug()
  5. Garvin Hicking commented on patch set 1 11/18/24, 07:38

    SchedulerCommand.php:196 Reply

    Good idea on order of things, yes. I'd say though the error message itself without the context is really not helpful, I'd add these extra lines independent of verbose/debug. Or maybe make "title&class" be the fixed output context, and just "description" optional as this probably is least important?
  6. Philipp Kitzberger commented on patch set 1 11/18/24, 09:48

    SchedulerCommand.php:196 Reply

    Rather like this? https://forge.typo3.org/issues/100946#note-11 I wouldnt hide anything behind a verbosity/debug flag at all. In case a scheduler task fails and a mail is being sent, I as a webmaster, want the details right away.
  7. Benni Mack commented on patch set 1 11/18/24, 13:23

    I'm fine adding this to 13.4 as well as a regular TASK.
  8. Garvin Hicking updated the commit message in patch set 2 V +1 11/18/24, 19:11

  9. core-ci voted on patch set 2 V +1 11/18/24, 19:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69616

  10. Garvin Hicking commented on patch set 2 11/18/24, 19:19

    SchedulerCommand.php:196 Reply

    Would be fine by me; @mbrodala@pagemachine.de ? Alternate proposal: ``` [ERROR] boom Exception in scheduler task #3 (Execute console commands) Command: cleanup:previewlinks ``` (I relabelled this patch and added 13.4 as a target, hope that's fine with you all; if not, change it as you prefer 😊)
  11. Mathias Brodala commented on patch set 2 11/19/24, 08:07

    SchedulerCommand.php:196 Reply

    Yup, I'd prefer Garvins suggestion. This way the error keeps its primary position. And additional details follow.
  12. Philipp Kitzberger uploaded patch set 3 V +1 11/19/24, 09:05

  13. core-ci voted on patch set 3 V -1 11/19/24, 09:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69673

  14. Philipp Kitzberger uploaded patch set 4 V -1 11/19/24, 09:54

  15. core-ci voted on patch set 4 V +1 11/19/24, 10:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69681

  16. Mathias Brodala commented on patch set 4 CR -1 11/19/24, 10:54

    SchedulerCommand.php:195

    Missing a space here.

    SchedulerCommand.php:195

    Since barely anybody still uses pre-*nix MacOS nowadays, this should be "\n" instead. But maybe better skip the description altogether since it probably doesn't help much.
  17. Philipp Kitzberger uploaded patch set 5 CR -1 V +1 11/19/24, 10:56

  1. Philipp Kitzberger commented on patch set 4 11/19/24, 10:57

    SchedulerCommand.php:195 Reply

    Done

    SchedulerCommand.php:195 Reply

    Done
  2. Mathias Brodala commented on patch set 5 11/19/24, 11:03

    SchedulerCommand.php:194

    No need to implode(), ->error() accepts an array of messages natively.
  3. core-ci voted on patch set 5 V +1 11/19/24, 11:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69686

  4. Mathias Brodala commented on patch set 6 V +1 11/19/24, 11:23

    Published edit on patch set 5.
  5. Mathias Brodala commented on patch set 6 11/19/24, 11:23

    SchedulerCommand.php:194 Reply

    Done

    SchedulerCommand.php:196 Reply

    Done
  6. core-ci voted on patch set 6 V +1 11/19/24, 11:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69692

  7. Garvin Hicking commented on patch set 6 CR +1 V +1 11/19/24, 12:48

    Thanks for streamlining this!
  8. Mathias Brodala voted on patch set 6 CR +1 11/19/24, 13:20

  9. Christoph Lehmann commented on patch set 6 11/20/24, 07:45

    SchedulerCommand.php:186

    Also add $e->getLine()and $e->getFile() ?
  10. Philipp Kitzberger commented on patch set 6 11/20/24, 15:25

    SchedulerCommand.php:186 Reply

    Yeah, good idea. I'm all for it. Any other opinions on that? [ERROR] Boom Exception in scheduler task #3 (Execute console commands) Command: cleanup:previewlinks File: /var/www/html/typo3/sysext/workspaces/Classes/Command/CleanupPreviewLinksCommand.php:67
  11. Garvin Hicking commented on patch set 7 CR +1 V +1 11/20/24, 16:47

    Published edit on patch set 6.
  12. core-ci voted on patch set 7 V +1 11/20/24, 16:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69818

  13. Garvin Hicking commented on patch set 7 CR +1 V +1 11/20/24, 17:37

    SchedulerCommand.php:186 Reply

    Good suggestion, thanks! The order is fine for me personally, I adjusted the patch accordingly. Note: For "native" scheduler tasks this reports the line/file properly. However, for "execute console commands", if no specific exceptions are involved, this will resolve to: ``` File: /var/www/html/typo3-core/typo3/sysext/scheduler/Classes/Scheduler.php:169 ``` because there we have: ``` if (!$successfullyExecuted) { throw new FailedExecutionException('Task failed to execute successfully. Class: ' . get_class($task) . ', UID: ' . $task->getTaskUid(), 1250596541); } ``` Thus, for a failed symfony console command the output would look like: ``` [ERROR] Task failed to execute successfully. Class: TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandTask, UID: 28 Exception in scheduler task #28 (Execute console commands) Command: mailer:spool:send File: /var/www/html/typo3-core/typo3/sysext/scheduler/Classes/Scheduler.php:169 ``` Once a "native" exception is thrown in a symfony cli command (not just using the CLI `->error/warning()` methods) this would bubble through. That's fine by me and could be tackled by a follow-up (if at all).
  14. Christian Kuhn voted on patch set 7 CR +1 V +1 11/20/24, 19:38

  15. Christoph Lehmann commented on patch set 7 11/20/24, 20:27

    SchedulerCommand.php:186 Reply

    > That's fine by me and could be tackled by a follow-up (if at all). For me too

    SchedulerCommand.php:190

    Note: possibly sensitive Symfony command arguments would be send out per cron mail. Maybe just use $task->getCommandIdentifier() instead $task->getAdditionalInformation()
  16. Torben Hansen commented on patch set 7 CR -1 11/21/24, 14:32

    SchedulerCommand.php:190 Reply

    This is right and we should not send possible sensitive information via email (possibly not encrypted).
  17. Oliver Hader commented on patch set 7 CR -1 11/21/24, 14:32

    SchedulerCommand.php:190 Reply

    Good suggestion by Christoph: Details/Configs (e.g. API keys, passwords, ...) should not be transmitted via e-mail.
  18. Garvin Hicking commented on patch set 8 CR +1 V +1 11/21/24, 19:14

    Published edit on patch set 7.
  19. Garvin Hicking commented on patch set 8 CR +1 V +1 11/21/24, 19:15

    SchedulerCommand.php:190 Reply

    Thanks for the feedback, I've adjusted this accordingly. Let me know if there are further objections.
  20. core-ci voted on patch set 8 V +1 11/21/24, 19:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69979

  21. Christoph Lehmann voted on patch set 8 CR +1 11/22/24, 12:12

  22. Philipp Kitzberger voted on patch set 8 CR +1 V +1 11/22/24, 12:44

  23. Christian Kuhn voted on patch set 8 CR +1 V +1 11/22/24, 13:56

  24. Garvin Hicking voted on patch set 8 CR +2 V +2 11/22/24, 18:46

  25. Garvin Hicking merged patch set 9 11/22/24, 18:56