Description
Summary
Recently in an ActiveJob worker we faced an issue where an exception was raised during deserialization of the arguments due to some database connection issues. This raised an ActiveJob::DeserializationError
exception, which was caused by the following:
ActiveJob::DeserializationError Error while trying to deserialize arguments: PG::ConnectionBad: PQsocket() can't get socket descriptor
Because the ActiveJob::DeserializationError
is ignored by default then this was not sent to Sentry.
The exception was added due to #701 and #642 where it was assumed that this is only raised when a record cannot be found but like the case above this is not the case. It's easy enough to fix in a particular app as it can just be removed from the default ignored exceptions but I feel like it could trip up new users of the gem using ActiveJob.
It would be great if we could somehow report these legitimate errors, and still ignore the NotFound type errors due to the intentioned lined out in the issues above.
We have the inspect_exception_causes_for_exclusion
config option for the SDK. I understand that was added to not change the behaviour for existing users, but are there any plans for making that the default in the future?
If there are, I suppose we could just remove ActiveJob::DeserializationError
when that happens as the NotFound style deserialization errors would be caught via ActiveRecord::RecordNotFound
through the ExceptionCauseChain middleware.
Or if it remains solely to avoid the SentryJob
example breaking when it isn't able to find a record, an alternative could be to remove it and update the async example to discard the job upon encountering a deserialization error via discard_on
.
Wondered what your thoughts were, especially as the gem is currently undergoing a revamp. Happy to help with a PR too!