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

5.2.0 Task Scheduler Erratic Behavior #44356

Open
bascherz opened this issue Oct 25, 2024 · 2 comments
Open

5.2.0 Task Scheduler Erratic Behavior #44356

bascherz opened this issue Oct 25, 2024 · 2 comments

Comments

@bascherz
Copy link

bascherz commented Oct 25, 2024

Steps to reproduce the issue

Use the Cron method to schedule a task on the same day/time every month. My case has this task running at 10:00am on the 20th of every month (every weekday).

  • Minutes: 0
  • Hours: 10
  • Days: 20
  • Months: all
  • Weekdays: all

Expected result

I expect the task to run once per month at 10:00. More specifically, I expected it to run on Oct 20, 2024 and next time after that on Nov 20.

Actual result

The task ran the first time at 10:00 on Oct 24, but it got stuck (see comments). So I stopped it and ran it manually around noon. The next time it ran was at 10:00 on Nov 20, 2024, and it has been running every 3 minutes since. It is still running every 3 minutes as of the time of this writing. What locked-in the 3-minute interval is a mystery.

System information (as much as possible)

  • Joomla! version: 5.2.0 Stable [ Uthabiti ] 15-October-2024 16:00 GMT
  • PHP Version: 8.2.24
  • PHP Built On: Linux na8861.serversignin.com 4.18.0-477.10.1.lve.el8.x86_64 Test #1 SMP Wed May 17 07:12:55 EDT 2023 x86_64
  • Database Type: mysql
  • Database Version: 10.11.9-MariaDB
  • Database Collation: utf8mb4_unicode_ci

Additional comments

  • The task eventually gets stuck and does not complete running (running man icon shown on task). I have the cronjob running the task scheduler every minute and the Joomla scheduler timeout set to 55 seconds. It appears the running man icon indicates the task did not complete before the next scheduler Cron "tick". This should not be possible considering how little the task does.
  • The task runs perfectly every time the Run Test button is clicked.
  • The Run Test button changes the Next Scheduled Time. It should never do this. The schedule, regardless what method is used, should be honored and never modified if a test is run. I have a suspicion that 3 minutes passed between me stopping the task and clicking Run Test.
  • UPDATE 1: Testing with 5-minute interval. Runs at correct interval. Task should be sending an email, but it seems that might be what is causing it to not finish. FIX: Hanging was due to using getCfg() instead of just get() to get site parameters. Interesting that before discovering this, the task worked when "Run Test" (Run Task??) is clicked, but not on a scheduled run.
  • UPDATE 2: Testing with 1-hour interval...working with interval setup. Working with cron setup.
  • UPDATE 3: Testing with 1-day interval...working with cron setup...

CONCLUSIONS:

  • It appears the "erratic" behavior I observed was actually CAUSED by the issue using getCfg() in my task versus get(). The task would get hung and not complete. Then the scheduler would eventually time it out and continue trying to run it. I think the retry interval when that happened ended up being 3 seconds for some reason.
  • The fact that getCfg() works with Run Test and not with a scheduled run maybe should be investigated, though that may be moot since getCfg() support is going away for Joomla! 6.
  • When saving the task, it is the Next Execution Time that matters initially and that seems to be getting set correctly every time now. The intervals and Cron scheduling appear to be working in this regard with 5.2.0, so that's an improvement over 5.1.4.
  • I am going to go out on a limb here and predict the remainder of my interval and cron testing is going to work as well. But I will keep this ticket "alive" for another day to be sure.
@Quy
Copy link
Contributor

Quy commented Oct 25, 2024

The Run Test button changes the Next Scheduled Time. It should never do this. The schedule, regardless what method is used, should be honored and never modified if a test is run.

See #36453 and PR #36725.

@bascherz
Copy link
Author

bascherz commented Oct 25, 2024

The Run Test button changes the Next Scheduled Time. It should never do this. The schedule, regardless what method is used, should be honored and never modified if a test is run.

See #36453 and PR #36725.

Well, that's an easy way out. Just change the button label. I think perhaps it's OK if Run Test (or Task) determines the next execution time if a method is used that does not specify a date and/or time. In those cases, the scheduler should always honor those settings.

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