Search code examples
ruby-on-railsdelayed-job

Can't figure out Delayed::DeserializationError


I am running delayed_job 3.0.5 (delayed_job_active_record 0.4.1) with Rails 3.2.12. I am having problems with some of my jobs failing because of "Deserialization". Here is a really simple example of one of the failing handlers:

--- !ruby/struct:Delayed::PerformableMethod
object: LOAD;Project;924951
method: :send_project_open_close_without_delay
args: []

When I try to invoke this job:

Delayed::DeserializationError: Job failed to load: undefined method `members' for nil:NilClass.

Everyone seems to think this is caused by an AR object that no longer exists. In my case, I can run the handler just fine:

Project.find(924951).send_open_close_without_delay

What else could be causing the error?


Solution

  • Just in case anyone ever runs into this issue. I figured out the cause was some of the jobs were injected with an older version of Delayed Job. So when the newer Delayed Job attempted to process them, it was unable to deserialize the handler.