Bug #87312

Scheduler fails at ConsoleCommand at the same time with the same idenitifer

Added by Guido Schmechel 7 months ago. Updated 6 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
scheduler
Target version:
-
Start date:
2018-12-31
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Context:

  • Given is a Symfony console command registered with "test:job"
  • This job has one required argument "message"
  • Activate two tasks in the scheduler, e.g. every minute
  • TYPO3 Cronjob runs every minute, too (CLI)
  • Task 1 registered with argument "hello", Task 2 registered with argument "world"

Problem:

  • TYPO3 processes the jobs sequential
  • First call is "scheduler:run" via CLI
  • Second call is our Task 1 (hello)
  • vendor/symfony/console/Command/Command.php has no "command". Here is the magic to add these "command". So we have now "test:job" as command and "hello" as message. Job runs successfully.
  • Third call (Task 2) has only the argument "message" (world) and TYPO3 runs the job without the "command" argument
  • The Job exit with code 255 and save the trace into the database field

Error message

a:5:{s:4:"code";i:0;s:7:"message";s:42:"Not enough arguments (missing: "command").";s:4:"file";s:66:"project\vendor\symfony\console\Input\Input.php";s:4:"line";i:76;s:11:"traceString";s:2742:"#0 project\vendor\symfony\console\Input\Input.php(42): Symfony\Component\Console\Input\Input->validate()
#1 project\vendor\symfony\console\Input\ArrayInput.php(34): Symfony\Component\Console\Input\Input->__construct(Object(Symfony\Component\Console\Input\InputDefinition))
#2 project\public\typo3\sysext\scheduler\Classes\Task\ExecuteSchedulableCommandTask.php(88): Symfony\Component\Console\Input\ArrayInput->__construct(Array, Object(Symfony\Component\Console\Input\InputDefinition))
#3 project\public\typo3\sysext\scheduler\Classes\Scheduler.php(180): TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandTask->execute()
#4 project\public\typo3\sysext\scheduler\Classes\Command\SchedulerCommand.php(145): TYPO3\CMS\Scheduler\Scheduler->executeTask(Object(TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandTask))
#5 project\public\typo3\sysext\scheduler\Classes\Command\SchedulerCommand.php(99): TYPO3\CMS\Scheduler\Command\SchedulerCommand->loopTasks()
#6 project\vendor\symfony\console\Command\Command.php(255): TYPO3\CMS\Scheduler\Command\SchedulerCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 project\vendor\symfony\console\Application.php(901): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 project\vendor\symfony\console\Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(TYPO3\CMS\Scheduler\Command\SchedulerCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 project\vendor\symfony\console\Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 project\public\typo3\sysext\core\Classes\Console\CommandRequestHandler.php(63): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 project\public\typo3\sysext\core\Classes\Console\CommandApplication.php(48): TYPO3\CMS\Core\Console\CommandRequestHandler->handleRequest(Object(Symfony\Component\Console\Input\ArgvInput))
#12 project\public\typo3\sysext\core\bin\typo3(23): TYPO3\CMS\Core\Console\CommandApplication->run()
#13 project\public\typo3\sysext\core\bin\typo3(24): {closure}()
#14 {main}";}

History

#1 Updated by Guido Schmechel 7 months ago

  • Description updated (diff)

#2 Updated by Guido Schmechel 7 months ago

This isn't a real fix, just a short workaround

typo3/sysext/scheduler/Classes/Task/ExecuteSchedulableCommandTask.php Line 89

        $definition = $schedulableCommand->getDefinition();
        if ($definition->hasArgument('command') && !array_key_exists('command', $this->getArguments())) {
            $this->arguments = array_merge($this->getArguments(), ['command' => $schedulableCommand->getName()]);
        }

Unfortunaly i don't know why the command info is lost in a loop scenario.

#3 Updated by Guido Schmechel 7 months ago

  • Description updated (diff)

#4 Updated by Riccardo De Contardi 6 months ago

  • Category set to scheduler

Also available in: Atom PDF