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

[Bug] Cron Task Occasionally Expires Due to Server Thread Hitch Warning #704

Open
st860923 opened this issue Feb 5, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@st860923
Copy link

st860923 commented Feb 5, 2025

Describe the bug
When scheduling a cron task using lib.cron.new("0 21 * * *", callback, { debug = true }), the task sometimes fails to execute due to a scheduled time expired error. The logs show that the task is scheduled correctly, but when the execution time arrives, it is skipped with a message indicating it expired by a small margin (e.g., 1 second).

To Reproduce
Steps to reproduce the behavior:

  1. Schedule a cron job with lib.cron.new("0 21 * * *", callback, { debug = true })
  2. Wait for the scheduled time while monitoring logs.
  3. Occasionally, the task is skipped due to a slight time drift, likely caused by server hitches.

Expected behavior
The scheduled task should execute at the specified time, with reasonable tolerance for minor server hitches.

Suggested Fix

  • Introduce an allowExpiredTasks parameter when scheduling a cron task:
    lib.cron.new("0 21 * * *", callback, { debug = true, allowExpiredTasks = true })

PR #705

Additional context
FXServer Version: Build 7290

[script: ...] (Tuesday 21:00, 04 February 2025) running task 2
[script: ...] stopping task 2 (scheduled time expired 1 seconds ago)

This issue does not occur consistently but seems to happen more frequently under higher server load.

Thanks for your time!

@st860923 st860923 added the bug Something isn't working label Feb 5, 2025
@st860923 st860923 changed the title [Bug] Cron Task Occasionally Expires Due to Server Hitch [Bug] Cron Task Occasionally Expires Due to Server Thread Hitch Warning Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant