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

Ignore ActiveJob::DeserializationError by default #701

Closed
nateberkopec opened this issue Jul 3, 2017 · 4 comments
Closed

Ignore ActiveJob::DeserializationError by default #701

nateberkopec opened this issue Jul 3, 2017 · 4 comments
Milestone

Comments

@nateberkopec
Copy link
Contributor

See #642. Activejob deserialization errors are pretty common, usually raised when we deleted the record we were going to process in a background job:

class PopulateDocsJob < ApplicationJob
  def perform(repo)
    repo.populate_docs!
  end
end

However, if you have an async config that looks like:

class SentryJob < ApplicationJob
  queue_as :default

  def perform(event)
    Raven.send_event(event)
  end
end

and repo isn't found, you'll raise ActiveJob::DeserializationError and blow up your Sidekiq instance as we run into an infinite loop.

Since ActiveJob::DeserializationError is basically a NotFound error, we should ignore it by default, just like all the other NotFound errors we ignore by default.

@mrhead
Copy link

mrhead commented Jul 4, 2017

Hmm, we do not ignore ActiveRecord::RecordNotFound in our application. The same goes for ActiveJob::DeserializationError. I want to be informed when it happens so I can check what is wrong.

@nateberkopec
Copy link
Contributor Author

@mrhead What do you have excluded_exceptions set to in your config, then?

I opened this issue after realizing 99% of the ActiveJob::DeserializationErrors that I see are just from records being deleted between the job being enqueued and the job executing. They're just noise.

@mrhead
Copy link

mrhead commented Jul 4, 2017

To this:

config.excluded_exceptions = ["ActionController::RoutingError", "ActionController::BadRequest"]

ActiveJob::DeserializationErrors happen also when you schedule a job from a DB transaction and the job is executed before the transaction is committed. While, this is usually harmless because Sidekiq just restarts the job and then it finish successfully, it can be an issue if for whatever reason you set number of retries to 0.

On the other hand I agree that this is just a noise and probably nothing bad happens if these errors get ignored.

@mrhead
Copy link

mrhead commented Jul 10, 2017

I've just received an ActiveJob::DeserializationError and I realized that one reason why I care about these errors is that I know when they happen and I can manually clear the Sidekiq queue and/or make sure that these errors don't happen anymore.

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

No branches or pull requests

2 participants