XF 2.2 Check cron job run times?

Fullmental

Active member
Is there a way to check how long a cron job is running for? We suspect one isn't behaving because we are suddenly getting occasional lag spikes of up to 2 minutes every now and then, but there are many that run concurrently. They don't seem to be consistent with user activity which is why I suspect a background task.

How can we see stats based on how long each one runs for? Is there a log anywhere we can review?
 
There's nothing built in that will do that as far as I'm aware.

I wrote an addon to help debug Cron/Job issues, which may be of help here: https://xenforo.com/community/resources/cli-job-cron-runner.7931/

You can execute Cron tasks manually and include additional information about execution time, etc.

If it's your own code, you can also include additional logging information that will be output to the console when the Cron task executes.
 
There's nothing built in that will do that as far as I'm aware.

I wrote an addon to help debug Cron/Job issues, which may be of help here: https://xenforo.com/community/resources/cli-job-cron-runner.7931/

You can execute Cron tasks manually and include additional information about execution time, etc.

If it's your own code, you can also include additional logging information that will be output to the console when the Cron task executes.
Thank you. We've been running this and apparently we're seeing run times in excess of 2 minutes for the hourly cleanup job every now and then. Any way to get more granular on this and know which part of that hourly cleanup is taking so long? It seems something in that job (or something running at the same time as that job) is locking the database tables and preventing people from accessing the site while it is running. It's very difficult to catch it running when there's a problem though, because it doesn't happen with every hourly run, and the window to catch it and try to check mysql stats and lock status seems to be only a minute or two...

Edit: We enabled some logging on the mysql instance, hopefully that can zero in on the exact queries that are causing issues.
 
Last edited:
Back
Top Bottom