Skip to content
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

Workers crash when Delayed::DeserializationError: ActiveRecord::RecordNotFound is raised #1157

Open
edwinthinks opened this issue Nov 23, 2021 · 1 comment

Comments

@edwinthinks
Copy link

Hello there,

We noticed that our workers when encountered with a delayed job that specifies a deleted object in its handler cause the workers to crash and halt processing more jobs.

Delayed::DeserializationError: ActiveRecord::RecordNotFound, class: CalendarRule, primary key: 485423 (Couldn't find SomeModel with 'id'=485423)
from /Users/emak/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/psych_ext.rb:48:in `rescue in visit_Psych_Nodes_Mapping'
Caused by ActiveRecord::RecordNotFound: Couldn't find SomeModel with 'id'=485423
from /Users/emak/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/relation/finder_methods.rb:357:in `raise_record_not_found_exception!'

It appears that this raise error is intentional but is I think it is odd that the worker would flat out crash and not just move on if there was an issue. Is there a way to make these errors occur but not crash our workers (we are using heroku dynos)

Any help would be great!

@smudge
Copy link

smudge commented Nov 29, 2021

When executing jobs, the worker should rescue these errors here, but it's possible for deserialization failures to crash workers if a lifecycle hook (typically from a plugin) that runs outside of that run method attempts to deserialize a job (e.g. by calling payload_object). Is there a more complete stacktrace that might point to a particular plugin you are using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants