-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Cron-like jobs not always executed, possible reasons? #359
Comments
Immediately, looking at those logs, it seems like the Rails process is crashing out and restarting over and over:
If the process that includes So my hypothesis is that the process is crashing/restarting. Why? I will try to reproduce that, but hopefully that helps you debug on your end too. Edit: Here is where the log message originates: good_job/lib/good_job/cron_manager.rb Lines 44 to 49 in d68de09
|
A-ha! That's something I haven't considered. We're using passenger+nginx and checking its logs definitely reveal a correlation in timestamps.
I'll have to look into if passenger + |
Yep, that was a good call. I didn't correlate it to passenger as I didn't know the log output indicates process restart. To quote a few passages of the passenger docs, emphasis mine:
Which ultimately leads me to believe that setting From the docs, emphasis mine:
I can't say for certain that this will solve our issue, but I think the evidence so far would support this theory. So the default settings of passenger do not play well with Thank you for the quick answer! In hindsight, if this is indeed the case, it seems obvious. |
fhew, glad that we have a clear culprit (Passenger). I think you're on the right track.
Another idea, if you're running this on your own server,is to simply use a rake task + crontab to schedule those jobs, rather than GoodJob's cron. GoodJob's cron is good, but I would recommend using a system/platform-level scheduler if you have it. |
Definitely! Critical tasks are being scheduled using crontab, but we also want to provide our app developers to easily schedule "nice to have" tasks where we have a relative certainty that they'll be executed. Adapting our passenger config should yield the proper results. We're working and testing different configs now and I'll report back if it worked. Feel free to close this issue already, since it doesn't seem to be an issue with this gem. |
@aried3r, sorry for waking an ancient thread, but did you ever sort out your Passenger config? I ran into the same issue, but wasn't sure if anyone else effectively solved it. Thanks! |
@clajiness I think here #373 its added on the readme |
I'm not sure if this is perhaps just a configuration error, but we're seeing some issues with cron-like jobs not always being executed.
We're still experimenting a bit with GoodJob, so configuration is still changing and not final. Currently we have it all in an initializer because we don't want to have configuration in multiple places for now.
Regular jobs using
.perform_later
work as expected from what we can see, but we're having issues with some cron-like jobs.As of now have very mild workloads regarding jobs. Perhaps a couple hundred a day, less than 500 even. This will increase as we add more background jobs in our app. And, as you'll see in our configuration below, 2 cron jobs that execute a total of 6 times per week.
Could this perhaps have anything to do with when GoodJob "wakes up", to handle cron-like jobs? I'm not exactly sure how GoodJob works under the hood for these sort of jobs, so our best guess was that we don't have enough workload for GoodJob to "wake up" more often and thus miss the scheduled time.
Could you maybe shed some light on how it works internally in
:async
mode or in general if there is no difference? We'd love to know when and what is triggering theGoodJob started cron with 2 jobs.
log messages. I've found the source but haven't yet tracked down when exactly that is being executed.Our configuration looks like this:
And from our logs. On the 30th the cron-like job executed as expected at 09:00.
I also posted some lines before and after in case there's context. But the important line, I assume, is the one from
2021-08-30T09:00:00.061463
. At this point, we only had one job scheduled for MON-FRI at 09:00.On August 31st and September 1st we had the following logs. Here just the one from today. By now we have two scheduled jobs, as can be seen in the configuration above. However the job scheduled for MON-FRI at 09:00 is not being executed.
I'm posting here, because I wasn't sure if it's a bug or if it should go to Q&A Discussions. Feel free to move this issue to a discussion if this is the wrong place!
Thanks!
The text was updated successfully, but these errors were encountered: