-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
ActiveJob::DeserializationError
is not reported to Sentry
#2451
Comments
ActiveJob::DeserializationError
is caught by ActiveRecord::RecordNotFound
in config.excluded_exceptions
ActiveJob::DeserializationError
is not reported to Sentry
hmm yeah that's a really unfortunate combination of defaults that causes undesired behaviour. cc @st0012 @solnic can you think of better ways of handling such scenarios?
|
I think the most ideal solution is that defaults will vary depending on the context in which the exception is raised (maybe through the For example:
We can NOT use integration for this because integrations like The value for {
"rack": ["ActiveRecord::RecordNotFound"`, # .... ],
"background_job: []
} |
yeah that's a good idea but now thinking more about it, I don't even know if it's about rack vs jobs. |
Or remove |
I think this will make a lot of our customers blow their quota much faster, so I don't think we're going to do this, sorry! |
Not pretty, but we can just look at the trace and see if it's coming from the ActiveJob stack and act accordingly. |
Issue Description
We had some jobs that were failing because by the time they were processed, the records they operated on no longer existed. The exception in the job was a
ActiveJob::DeserializationError
, and we were confused about why these errors did not appear in Sentry.It turns out that internally, Active Job is calling
GlobalID::Locator.locate
, which is callingModel.find(...)
, which is raisingActiveRecord::RecordNotFound
.The exception is then rescued in Active Job, and re-raised as an
ActiveJob::DeserializationError
.But because the
Exception#cause
is anActiveRecord::RecordNotFound
, and this error type is in the defaultexcluded_exceptions
added bysentry-rails
, andconfig.inspect_exception_causes_for_exclusion
is enabled by default, the exception wasn't reported.This seemed highly surprising to us and it took a long time to understand what was going on. Initially we assumed our exception handling code was buggy in some way.
I'm not sure if there could be some "better" defaults here, so I don't know if this is really a bug, but I thought it's worth discussing.
I couldn't find any information about why
ActiveRecord::RecordNotFound
is excluded by default. The earliest commit that adds it to the list is 343cc90, which looks like it imports code from elsewhere, so I don't have access to the history before that.I assume that
ActiveRecord::RecordNotFound
is excluded because it is commonly raised in web endpoints. I'm not sure if this is justified, as it's easy to add arescue_from
to controllers to handle this without re-raising (e.g. to render a 404). In any case, it seemed very surprising that this ended up impacting an exception raised during job processing.Reproduction Steps
MyJob.perform_later(user: User.new(id: 999999))
Expected Behavior
The exception is reported to Sentry
Actual Behavior
The exception is silently discarded
Ruby Version
3.3.5
SDK Version
5.15.2 (but the latest version has the same behaviour)
Integration and Its Version
Rails
Sentry Config
No response
The text was updated successfully, but these errors were encountered: