Skip to content

Fix Sidekiq reporting to Sentry outside of job contexts

Sean McGivern requested to merge fix-sidekiq-error-processor-outside-a-job into master

We have a module that processes Sidekiq job data before sending it to Sentry. However, if Sentry is enabled (which means we'll use this class) and Sidekiq encountered an error outside of a job's context, the processor itself could break, which is extra-bad: we won't get anything in Sentry and we actually have two problems.

Sidekiq will still log something like this:

!!! ERROR HANDLER THREW AN ERROR !!!

But we shouldn't permit that to happen.

The motivating example for this case was having the Sidekiq metrics server unable to bind to its port because something else was already using this. By default it uses port 8082 so running this script will bind to that port and prevent Sidekiq from using it:

#!/usr/bin/env ruby

require 'webrick'

server = WEBrick::HTTPServer.new(BindAddress: "0.0.0.0",
                                 Port: 8082,
                                 DocumentRoot: ".")

trap("INT") { server.shutdown }

server.start

See #349592 (comment 803046391) for more details.

Merge request reports