Close a Time-of-Check Time-of-Use style time window in
Scheduler::executeTask() by checking the actual task execution id value
after the allocation instead of checking for any task execution id
allocations long before the actual execution id allocation happens. The
time window allowed multiple scheduler invocations to pick up and
execute the same non-parallel scheduler task at the same time.
Make SchedulerTaskRepository::addExecutionToTask() and
SchedulerTaskRepository::removeExecutionOfTask() atomic by modifying
(UPDATE) the value of the "serialized_executions" field only if it's
still set to the update base value previously SELECT-ed. That allows
parallel invocations of SchedulerTaskRepository::addExecutionToTask() to
no longer obtain the same execution id and fixes a bug in
SchedulerTaskRepository::removeExecutionOfTask() that reverted
removals of execution ids.
Adjust SchedulerTaskRepository::addExecutionToTask() to no longer
hallucinate a non-existing execution id of 0 in situations were the
persistence record associated with the task cannot be SELECT-ed from the
database.
Change SchedulerTaskRepository::removeExecutionOfTask() to no longer
override the previous value of the tasks record "lastexecution_failure"
field if the given `$failureReason` method argument is `null`. This is
due to the change described in the first paragraph, where we need to
remove the execution of a task when it wasn't executed. The previous as
well as the updated implementation of Scheduler::executeTask() always
pass in a value of type `string` if the task execution happened.
A full reproduction is available online on GitHub:
https://github.com/adamkoppede/typo3-parallel-scheduler-task-processing-test