Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduler: Manual Execution Rule blocks Lazy and Webcron #43767

Closed
brbrbr opened this issue Jul 10, 2024 · 1 comment
Closed

Scheduler: Manual Execution Rule blocks Lazy and Webcron #43767

brbrbr opened this issue Jul 10, 2024 · 1 comment

Comments

@brbrbr
Copy link

brbrbr commented Jul 10, 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');
        }
brbrbr added a commit to brbrbr/joomla-cms that referenced this issue Jul 10, 2024
@brbrbr brbrbr changed the title Scheduler: Manual Execution Rule blocks RunSchedulerWebcron Scheduler: Manual Execution Rule blocks Lazy and Webcron Jul 10, 2024
brbrbr added a commit to brbrbr/joomla-cms that referenced this issue Jul 10, 2024
@alikon
Copy link
Contributor

alikon commented Jul 13, 2024

please test #43784

@alikon alikon closed this as completed Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants