No Code Attached Yet
avatar brbrbr
brbrbr
10 Jul 2024

Steps to reproduce the issue

Create a Scheduled task with Manual Execution. For example, change the default task Session GC to manual

Set another task on a short schedule.

Execute the webcron with id=0 (to bypass #43576 , looks solved #43164)

component/ajax/?plugin=RunSchedulerWebcron&group=system&format=json&hash=XXXX&id=0

or run the lazy scheduler

Expected result

all (id=0) due tasks are executed one by one on each call.
Manual tasks are skipped

Actual result

No task is executed.

Found in Joomla 4.4.6 and up

Additional comments

manual tasks should only be executed when called explicitly

component/ajax/?plugin=RunSchedulerWebcron&group=system&format=json&hash=XXXX&id=

The database column for next_execution is set to Null for Manual tasks

In the code in TaskModel:getTask $idQuery loads the first 'due' task order by next_execution, this is a task with next_execution=Null

Then the $lockQuery uses

$lockQuery->where($db->quoteName('next_execution') . ' <= :now2')

Which does not return the next_execution with value Null.

So the $lockQuery never finds a tasks.

The idQuery should probably have a ->where($db->quoteName('next_execution') .' IS NOT Null')

It looks like there are more possible issues.
cli_exclusive might be set to zero, while the idQuery ignores this setting. Same for allowDisabled

I think the queries in the code block shown below should be part of idQuery as well (and maybe even not lockQuery)

 if (!$options['includeCliExclusive']) {
            $lockQuery->where($db->quoteName('cli_exclusive') . ' = 0');
        }

        if (!$options['bypassScheduling']) {
            $lockQuery->where($db->quoteName('next_execution') . ' <= :now2')
                ->bind(':now2', $now);
        }

        if ($options['allowDisabled']) {
            $lockQuery->whereIn($db->quoteName('state'), [0, 1]);
        } else {
            $lockQuery->where($db->quoteName('state') . ' = 1');
        }
avatar brbrbr brbrbr - open - 10 Jul 2024
avatar joomla-cms-bot joomla-cms-bot - change - 10 Jul 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 10 Jul 2024
avatar brbrbr brbrbr - change - 10 Jul 2024
Title
Scheduler: Manual Execution Rule blocks RunSchedulerWebcron
Scheduler: Manual Execution Rule blocks Lazy and Webcron
avatar brbrbr brbrbr - edited - 10 Jul 2024
avatar brbrbr brbrbr - change - 10 Jul 2024
The description was changed
avatar brbrbr brbrbr - edited - 10 Jul 2024
avatar alikon alikon - change - 13 Jul 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-07-13 10:34:18
Closed_By alikon
avatar alikon alikon - close - 13 Jul 2024
avatar alikon
alikon - comment - 13 Jul 2024

please test #43784

Add a Comment

Login with GitHub to post a comment