bensheldon / good_job

Multithreaded, Postgres-based, Active Job backend for Ruby on Rails.
https://goodjob-demo.herokuapp.com/
MIT License
2.53k stars 190 forks source link

Undefined `GoodJob::Process.advisory_lockable_column` #1358

Closed JoeSouthan closed 1 month ago

JoeSouthan commented 1 month ago

Hi there!

We're noticing that we're getting this error after the release of v3.29.0. Seems that the GoodJob::Process.advisory_lockable_column is not set leading to this error when the advisory lock is unable to be taken.

[2] pry(main)> GoodJob::Process.advisory_lockable_column
=> nil

Seems to be coming from Process#create_record

NoMethodError: undefined method `to_sym' for nil (NoMethodError)

        [attribute.to_sym, type, options]
                  ^^^^^^^
  from activemodel (7.1.3.3) lib/active_model/errors.rb:496:in `normalize_arguments'
  from activemodel (7.1.3.3) lib/active_model/errors.rb:343:in `add'
  from good_job (3.29.0) app/models/concerns/good_job/advisory_lockable.rb:136:in `block (2 levels) in <module:AdvisoryLockable>'
  #  ...
  from good_job (3.29.0) app/models/good_job/process.rb:81:in `create_record'
  from good_job (3.29.0) lib/good_job/capsule_tracker.rb:92:in `block in register'
  from good_job (3.29.0) lib/good_job/capsule_tracker.rb:223:in `synchronize'
  from good_job (3.29.0) lib/good_job/capsule_tracker.rb:223:in `synchronize'
  from good_job (3.29.0) lib/good_job/capsule_tracker.rb:81:in `register'
  from good_job (3.29.0) lib/good_job/notifier/process_heartbeat.rb:19:in `block in register_process'
  from good_job (3.29.0) lib/good_job/overridable_connection.rb:26:in `override_connection'
  from good_job (3.29.0) lib/good_job/notifier/process_heartbeat.rb:17:in `register_process'
  from activesupport (7.1.3.3) lib/active_support/callbacks.rb:403:in `block in make_lambda'
  from activesupport (7.1.3.3) lib/active_support/callbacks.rb:274:in `block in simple'
  from activesupport (7.1.3.3) lib/active_support/callbacks.rb:602:in `block in invoke_after'
  from activesupport (7.1.3.3) lib/active_support/callbacks.rb:602:in `each'
  from activesupport (7.1.3.3) lib/active_support/callbacks.rb:602:in `invoke_after'
  from activesupport (7.1.3.3) lib/active_support/callbacks.rb:111:in `run_callbacks'
  from good_job (3.29.0) lib/good_job/notifier.rb:206:in `block (3 levels) in create_listen_task'
  from activesupport (7.1.3.3) lib/active_support/execution_wrapper.rb:92:in `wrap'
  from good_job (3.29.0) lib/good_job/notifier.rb:205:in `block (2 levels) in create_listen_task'
  from good_job (3.29.0) lib/good_job/notifier.rb:260:in `with_connection'
  from good_job (3.29.0) lib/good_job/notifier.rb:201:in `block in create_listen_task'
  # ...
bensheldon commented 1 month ago

Oh that's strange! I think I know what the problem is. Fix incoming.

bensheldon commented 1 month ago

I just released a fix for this. https://github.com/bensheldon/good_job/releases/tag/v3.29.1

JoeSouthan commented 1 month ago

Thank you for the swift fix!