Review main Merged

63964[BUGFIX] Skip input validation in scheduler command task

Armin Vieweg CR +2 V +2 Easy +1 −1 updated 04/17/20, 19:11

Commit message

All commands that are added via Configuration/Commands.php
are instantiated and prepared when the "scheduler:run" command is
executed. This preparation includes setting the Application object.

If this Application object is present in an Command object,
calling the run method of the command will cause a merge
of the application's arguments with command arguments.

Since command objects in symfony/console and TYPO3 are
more or less singletons, these merged arguments will
stay merged on a second "instantiation" of the command
through when scheduler executes the second task with the same command.

Therefore we must SKIP the validation of the new Input object
we create and pass to the command's run method, so that this
validation does not fail due to the missing command argument.

It also does not matter that we skip validation, because validation
happens implicitly when calling the run method on the command object.
Only Symfony code is "smart" enough to set the command argument,
when it was not present before.

Review

  • Code review CR +2 Done
    • Richard Haeser +2
    • Markus Klein +1
    • Manuel Selbach +1
    • Andreas Kienast +1
    • Helmut Hummel +1
    • Benni Mack +1
  • Verified V +2 Done
    • Richard Haeser +2
    • Markus Klein +1
    • Helmut Hummel +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 2430

Show 35 earlier messages
  1. Armin Vieweg uploaded patch set 1 03/28/20, 09:45

  2. Armin Vieweg updated the commit message in patch set 2 03/28/20, 09:46

  3. Armin Vieweg updated the commit message in patch set 3 03/28/20, 09:52

  4. TYPO3com voted on patch set 1 V +1 03/28/20, 10:06 Completed build in 21m 05s on Sat, 28 Mar, 10:06 AM Test Summary: 73044 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1888

  5. TYPO3com voted on patch set 3 V +1 03/28/20, 10:15 Completed build in 19m 55s on Sat, 28 Mar, 10:15 AM Test Summary: 73044 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1890

  1. TYPO3com voted on patch set 2 V -1 03/28/20, 10:16 Completed build in 20m 10s on Sat, 28 Mar, 10:16 AM Test Summary: 72736 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1889

  2. Daniel Goerz voted on patch set 3 CR +1 03/29/20, 21:34

  3. Oliver Klee voted on patch set 3 CR +1 03/30/20, 10:05

  4. Oliver Klee commented on patch set 3 04/11/20, 11:22

    Is there a way to cover this with a regression test?
  5. Helmut Hummel commented on patch set 3 CR -1 04/13/20, 08:02

    Imho whatever is done to make this case work needs to be done on the scheduler code that runs a command twice in the same request, not in generic code that provides the commands
  6. Armin Vieweg commented on patch set 3 04/13/20, 14:46

    > Patch Set 3: Code-Review-1 > > Imho whatever is done to make this case work needs to be done on the scheduler code that runs a command twice in the same request, not in generic code that provides the commands Commands in Symfony are not made to get executed twice, as we can see here. But this CommandRegistry treats commands like Singletons. This seems to me kind of wrong, in general.
  7. Helmut Hummel commented on patch set 3 04/13/20, 17:26

    > Commands in Symfony are not made to get executed twice, as we can see here. If that is really true, then we have one more argument why to either not do that, or make the code work that runs commands twice. > But this CommandRegistry treats commands like Singletons. If the assumption is correct that conceptually symfony/console isn't designed to run commands mutliple times, then this is implementation is correct or at least not wrong. > This seems to me kind of wrong, in general. Something might be wrong. I tried to reproduce the reported error but failed. Any hints how to get this properly reproduced (using TYPO3 master)? Which Sf package version is used? Which exact command is registered twice in Scheduler?
  8. Armin Vieweg commented on patch set 3 04/13/20, 18:21

    > Something might be wrong. I tried to reproduce the reported error but failed. Any hints how to get this properly reproduced (using TYPO3 master)? Which Sf package version is used? Which exact command is registered twice in Scheduler? Maybe a new version of symfony/console fixed this issue in 10. I've only tested in TYPO3 v9.
  9. Helmut Hummel updated the commit message in patch set 4 04/14/20, 13:51

  10. Helmut Hummel commented on patch set 4 CR -1 04/14/20, 13:55

    I removed master as target version for now. But I need to review whether this also is fixed for commands that are not registered with DI
  11. TYPO3com voted on patch set 4 V +1 04/14/20, 14:09 Completed build in 14m 04s on Tue, 14 Apr, 02:09 PM Test Summary: 73472 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2508

  12. Helmut Hummel updated the commit message in patch set 5 04/15/20, 13:03

  13. Oliver Klee voted on patch set 5 CR +1 04/15/20, 13:21

  14. Helmut Hummel commented on patch set 5 CR -1 04/15/20, 13:47

    I wrote a deeper analysis for the reasons of the failure here: https://forge.typo3.org/issues/87312#note-17 As I suspected in the beginning. The reason this error occures is in the code that executes the command and should be fixed there.
  15. Helmut Hummel uploaded patch set 6 04/15/20, 13:59

  16. Helmut Hummel commented on patch set 6 V +1 CR +1 04/15/20, 14:00

    Here is my proposal. As suggested, the fix is in the code that executes the Commands. Please test, whether this works for you as well.
  17. TYPO3com voted on patch set 5 V +1 04/15/20, 14:01 Completed build in 55m 30s on Wed, 15 Apr, 02:01 PM Test Summary: 73523 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2581

  18. TYPO3com voted on patch set 6 V +1 04/15/20, 14:27 Completed build in 16m 36s on Wed, 15 Apr, 02:27 PM Test Summary: 73523 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2584

  19. Benni Mack voted on patch set 6 CR +1 04/15/20, 16:00

  20. Markus Klein voted on patch set 6 CR +1 04/15/20, 21:36

  21. Manuel Selbach voted on patch set 6 CR +1 04/17/20, 15:34

  22. Andreas Kienast voted on patch set 6 CR +1 04/17/20, 17:57

  23. Markus Klein voted on patch set 6 V +1 04/17/20, 19:06

  24. Richard Haeser voted on patch set 6 V +2 CR +2 04/17/20, 19:11

  25. Richard Haeser merged patch set 7 04/17/20, 19:11