No Code Attached Yet bug
avatar HermanPeeren
HermanPeeren
7 Oct 2026

What happened?

When starting a Scheduler Task from the command line (with scheduler:run), it starts a task that is still running.

This bug only occurs when scheduled tasks are started from the command line. Joomla can start scheduled tasks in three ways: the Lazy Scheduler, Web Cron, and the command line (php cli/joomla.php scheduler:run), as described in How to Run Scheduled Tasks from the Command Line. The first two are not affected.

Steps to reproduce the issue

  1. In System → Scheduled Tasks, create a task of any type, for example Global Check-in. Note its ID.
  2. Directly in the database mark it as running, as a process that is still busy with it would (replace #__ and the ID):
    UPDATE #__scheduler_tasks SET locked = UTC_TIMESTAMP() WHERE id = 1;
  3. Run php cli/joomla.php scheduler:run --id=1
    (or set its Next Execution in the past and run scheduler:run --all).

Expected result

The task is not started, because it is locked and the lock is younger than the Task Timeout.

Actual result

The task runs again. In practice: when a cronjob runs scheduler:run --all every minute and a task takes longer than that, the next process starts the same task while the first is still running it. The first process can then not release its lock and ends with exit code 4 (NO_RELEASE).

Web Cron and the Lazy Scheduler start no task while any task is running, so they don't have this problem.

Suggested fix

Add the same condition as in Task::acquireLock() to buildLockQuery(): lock the task only when locked is NULL or older than the Task Timeout. If no row is updated, the task is running, and runTask() returns no task.

System Information

Joomla 6.1, PHP 8.3, MySQL 8.

Additional Comments

The Good to know section of the documentation page above mentions this behaviour; that paragraph can be simplified once this is fixed.

Possibly related: #44322 (Task Scheduler Looping). There, a long task run from an external cronjob every minute is started again every 6 minutes or so. In both issues a task is started again while it is still running, and its next execution has not been moved forward yet. What is different: in our current issue the task can be started again at once, while its lock is still valid. In #44322 the restarts come only after about 6 minutes: the default Task Timeout of 300 seconds plus the next cron minute. So there the lock seems to hold until it expires. The cronjob in that issue is used for Web Cron, not to run scheduler:run on the command line. Whether both issues have the same cause is not confirmed.

avatar HermanPeeren HermanPeeren - open - 7 Oct 2026
avatar joomla-cms-bot joomla-cms-bot - change - 7 Oct 2026
Labels Added: No Code Attached Yet bug
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Oct 2026
avatar HermanPeeren HermanPeeren - change - 7 Oct 2026
The description was changed
avatar HermanPeeren HermanPeeren - edited - 7 Oct 2026
avatar QuyTon
QuyTon - comment - 9 Oct 2026

Please test PR #48592.

Add a Comment

Login with GitHub to post a comment