No Code Attached Yet
avatar PhilETaylor
PhilETaylor
27 Dec 2021

Steps to reproduce the issue

When a scheduled task fails, it retains the lock and further scheduled runs will fail because it cannot acquire a lock.

Expected result

When a scheduled task fails, it should be logged, it should have the Times Failed increased, and the lock should be released so that on the next scheduled run, it can run again

Actual result

The task is permanently locked and a "running" icon is displayed in the admin console.

{
  "success": true,
  "message": null,
  "messages": null,
  "data": {
    "message": "could not acquire lock on task. retry or allow concurrency."
  }
}

Screenshot 2021-12-27 at 23 29 57

avatar PhilETaylor PhilETaylor - open - 27 Dec 2021
avatar joomla-cms-bot joomla-cms-bot - change - 27 Dec 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Dec 2021
avatar ditsuke
ditsuke - comment - 28 Dec 2021

Thanks for opening this issue. Originally, we were doing auto-recovery of "locked" tasks running beyond a set timeout (Scheduler config > Task Timeout). With the conversation from joomla-projects/soc21_website-cronjob#39, it was decided it's not such a good idea.

Normally, these perma-blocking locked tasks requiring manual checks are only possible if a task crashes the parent process or similar. However, I can see we still have edge cases we are not accounting for and recovering the locks.

I'm guessing you got this lock as a result of an orphaned task (#36436)? Can you share some more information?

avatar PhilETaylor PhilETaylor - change - 28 Dec 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-12-28 11:50:28
Closed_By PhilETaylor
avatar PhilETaylor PhilETaylor - close - 28 Dec 2021
avatar PhilETaylor
PhilETaylor - comment - 28 Dec 2021

If a task fails - like this

avatar PhilETaylor PhilETaylor - change - 28 Dec 2021
Status Closed New
Closed_Date 2021-12-28 11:50:28
Closed_By PhilETaylor
avatar PhilETaylor PhilETaylor - reopen - 28 Dec 2021
avatar PhilETaylor
PhilETaylor - comment - 28 Dec 2021

Like this #36455

avatar ditsuke
ditsuke - comment - 28 Dec 2021

Like this #36455

Thanks that's awesome. I'm on it.

avatar PhilETaylor
PhilETaylor - comment - 28 Dec 2021

the way I read that thread, Nics point is about unlocking running tasks, not failed tasks.

If a task fails, it is no longer running, you should release the lock and report the failure, allowing the task to run again (and maybe succeed) at a later schedule. All cron job systems do this.

avatar ditsuke
ditsuke - comment - 28 Dec 2021

the way I read that thread, Nics point is about unlocking running tasks, not failed tasks.

If a task fails, it is no longer running, you should release the lock and report the failure, allowing the task to run again (and maybe succeed) at a later schedule. All cron job systems do this.

Absolutely, and failed tasks are unlocked. We just have a few scenarios not covered so we aren't catching exceptions where we should be catching them. I'll work on fixing this soon so you can test. ?

avatar PhilETaylor
PhilETaylor - comment - 28 Dec 2021

ok cool - so the failure case I provided a useful one then

avatar PhilETaylor PhilETaylor - change - 7 Mar 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-03-07 18:36:06
Closed_By PhilETaylor
avatar PhilETaylor PhilETaylor - close - 7 Mar 2022
avatar sabersaberi2
sabersaberi2 - comment - 21 Mar 2025

hi
i have similar problem. i get this error:

{
    "success": true,
    "message": null,
    "messages": null,
    "data": {
        "message": "could not acquire lock on task. retry or allow concurrency."
    }
}

i change the
Scheduler config > Task Timeout
to 10 sec, but not any effect. i use shared hosting and can not check linux cron report.

how to resolve the problem?
i use joomla version 5.0.0

Add a Comment

Login with GitHub to post a comment