Open rgaufman opened 1 month ago
Thanks for the bug report! That's strange. Here's the line in question:
...the exception would imply that the Process record hasn't been persisted. Which is unexpected!
I'll dig into what might be happening here. That's weird!
I'm experiencing the same issue. Here are some details about my setup:
GoodJob version: 3.29.2 Rails version: 7.0.8 Ruby version: 3.3.0
Quick question, are you seeing these exceptions all come from the same place in the stacktrace? Particularly these first 6 lines?
/gems/good_job-3.29.2/app/models/good_job/process.rb:125 in stale?
/gems/good_job-3.29.2/app/models/good_job/process.rb:113 in refresh_if_stale
/gems/good_job-3.29.2/lib/good_job/capsule_tracker.rb:147 in block in renew
/gems/good_job-3.29.2/app/models/good_job/base_record.rb:39 in with_logger_silenced
/gems/good_job-3.29.2/lib/good_job/capsule_tracker.rb:146 in renew
/gems/good_job-3.29.2/lib/good_job/notifier/process_heartbeat.rb:27 in block (3 levels) in refresh_process
Yes, same stacktrace.
stale?(/usr/local/bundle/gems/good_job-3.29.2/app/models/good_job/process.rb:125)
refresh_if_stale(/usr/local/bundle/gems/good_job-3.29.2/app/models/good_job/process.rb:113)
block in renew(/usr/local/bundle/gems/good_job-3.29.2/lib/good_job/capsule_tracker.rb:147)
with_logger_silenced(/usr/local/bundle/gems/good_job-3.29.2/app/models/good_job/base_record.rb:39)
renew(/usr/local/bundle/gems/good_job-3.29.2/lib/good_job/capsule_tracker.rb:146)
block (3 levels) in refresh_process(/usr/local/bundle/gems/good_job-3.29.2/lib/good_job/notifier/process_heartbeat.rb:27)
It seems to be happening with any version good_job-3.29.0 and newer.
Oh wow. That is much more exceptions than I was imagining! 😦
Are you by chance using a forking webserver (like Puma with multiple WEB_CONCURRENCY)? I'm just wondering because I'm not seeing this on any of my production applications and my only idea is that things are being initialized differently before the process forks.
I just made a PR that I think could solve this problem but I'm not 100% sure. I'll release that this evening and hopefully it fixes it: https://github.com/bensheldon/good_job/pull/1369
I just released https://github.com/bensheldon/good_job/releases/tag/v3.29.3
Since doing a recent bundle update I am getting these exceptions randomly from random servers:
Any ideas what could be causing this?