Digests

Could not obtain cron lock - Digests

Re: Could not obtain cron lock

by mikeinthe852 » Tue May 28, 2024 3:00 am

If I set the cron at 15 * * * * then wouldn't all the processes just run at :15 causing the same potential lack of resources? No different than running at :00

I am exploring a way of temporally separating the run of the Digest from all the other typical core processes of the forum such as tidy_sessions. I understand that many core processes are set to auto, but some must be set to run at a particular time such as :00 or once an hour, just like the digest, which may be causing some resource issues.

However, I'm not even sure if this is an issue. Just brainstorming.
User avatar
mikeinthe852
Registered User
Posts: 132
Joined: Sun Aug 09, 2020 11:52 am

Re: Could not obtain cron lock

by MarkDHamill » Tue May 28, 2024 11:18 am

That is certainly possible, indeed likely. Anything queued to start as a cron could start when the cron is invoked. There is no built in way to say "start this cron but not that cron" that I am aware of.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: Could not obtain cron lock

by mikeinthe852 » Tue May 28, 2024 12:28 pm

Thank you Mark for all your help! I have learnt so much from our discussions over the years.
User avatar
mikeinthe852
Registered User
Posts: 132
Joined: Sun Aug 09, 2020 11:52 am

Re: Could not obtain cron lock

by MarkDHamill » Tue May 28, 2024 1:20 pm

Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: Could not obtain cron lock

by mikeinthe852 » Tue May 28, 2024 11:05 pm

Mark, we are having this unrelated issue
viewtopic.php?p=16014079#p16014079

1. In your opinion, should we try the database fix, or would it be better to upgrade to 3.3.12 rc1?
2. Would that database fix work? Does it have to be field 20?
3. Is 3.3.12 rc1 suitable for a live board?
User avatar
mikeinthe852
Registered User
Posts: 132
Joined: Sun Aug 09, 2020 11:52 am

Re: Could not obtain cron lock

by MarkDHamill » Tue May 28, 2024 11:31 pm

This appears to be unrelated so I'm not inclined to do an analysis, sorry.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: Could not obtain cron lock

by mikeinthe852 » Sat Jun 01, 2024 9:25 am

Hi Mark
Just FYI, I looked into the 'tidy_sessions' task https://area51.phpbb.com/docs/code/3.2. ... sions.html
and the timing can be set here
Screenshot 2024-06-01 171720.png
But I have noticed that the exact time the 'tidy_sessions' task is run varies a lot in one day, even though it's set to run every 60 minutes on our board.
Screenshot 2024-06-01 172940.png
I have also noticed that even just today the digest failed and the cron was locked when 'tidy_sessions' ran at :00
I suspect this is a resource issue.

Any thoughts on how to prevent these two tasks (digests and 'tidy_sessions') from running at the same minute? I understand that that is the entire purpose of the cron lock, but is it possible to prevent the 'tidy_sessions' task from running at :00? Your digest runs at exactly :00 so there must be some way to force an exact time of task execution. Just brainstorming.
User avatar
mikeinthe852
Registered User
Posts: 132
Joined: Sun Aug 09, 2020 11:52 am

Re: Could not obtain cron lock

by MarkDHamill » Sat Jun 01, 2024 11:39 am

I haven't tried it, but the article below describes a way that looks like it should work to cause a cron to start at the second wanted.

https://www.tecmint.com/run-cronjob-every-x-seconds/
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: Could not obtain cron lock

by mikeinthe852 » Sat Jun 01, 2024 3:03 pm

Very interesting, but what I really need is a way to prevent a task from starting at a certain time or restrict it to certain times.
How do you make your Digest only run at :00? Can you do the opposite? ie. make it run at any time except :00?

I see this in admin log
Emailed digests for date 2024-05-31 hour 22 UTC. Execution time: 4.64 of 0 allowed seconds. 66.25 MB of memory was used. A total of 68 digests were emailed
So, a typical Digest for us runs less than 5 seconds. I have balanced the load over 8 hours overnight, no hour has more than 70 digests.
To my untrained eye, this does not seem like excessive resource usage. So what is happening when the 'tidy_sessions' task wants to run at the same minute?

Should I program the server cron for 0,1,5,10,15,20,25,30,35,40,45,50,55? Can 'tidy_sessions' wait one minute without locking up?
User avatar
mikeinthe852
Registered User
Posts: 132
Joined: Sun Aug 09, 2020 11:52 am

Re: Could not obtain cron lock

by MarkDHamill » Sat Jun 01, 2024 4:55 pm

You ask a question I can't answer.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: Could not obtain cron lock

by mikeinthe852 » Mon Jun 03, 2024 5:20 am

Hi Mark, I sent you an email regarding an update. Hope all is well.
User avatar
mikeinthe852
Registered User
Posts: 132
Joined: Sun Aug 09, 2020 11:52 am

Re: Could not obtain cron lock

by MarkDHamill » Mon Jun 03, 2024 11:33 am

mikeinthe852 wrote:Hi Mark, I sent you an email regarding an update. Hope all is well.
I hope to get to it later today.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: Could not obtain cron lock

by mikeinthe852 » Tue Jun 18, 2024 12:07 pm

Should I program the server cron for 0,1,5,10,15,20,25,30,35,40,45,50,55?
It's been almost 3 weeks with this code, and no further issues with a cron lock. I will update as things progress, but so far so good!
User avatar
mikeinthe852
Registered User
Posts: 132
Joined: Sun Aug 09, 2020 11:52 am

Re: Could not obtain cron lock

by dawid1515 » Fri Aug 30, 2024 2:44 pm

Hello mikeinthe852,
I am having the same problem as you had mentioned where the cron is failing. Please could you advise how you have solved this problem?
dawid1515
Registered User
Posts: 1
Joined: Fri Aug 30, 2024 9:41 am