sidekiq-scheduler / sidekiq-scheduler

Lightweight job scheduler extension for Sidekiq

Home Page:https://sidekiq-scheduler.github.io/sidekiq-scheduler/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SidekiqScheduler::Manager enormous inspect output

eapache-opslevel opened this issue · comments

Trying to inspect an instance of SidekiqScheduler::Manager produces around 5k lines of output on our system because it holds references to a bunch of other complex objects and eventually starts printing large chunks of internal sidekiq and rails objects.

This is doubly annoying because with debug-logging enabled on sidekiq, the SidekiqScheduler::Manager instance is inspected/logged at sidekiq startup.

It's easy enough to monkey-patch with something like:

module SidekiqScheduler
  class Manager
    def inspect
      "SidekiqScheduler::Manager"
    end
  end
end

But there should probably be some debugging information included, and I don't know what values are worth logging here.

@eapache-opslevel could you provide this output? as an attached file and not a comment please 😄

I am not able to share this output, as the resulting dump of ruby objects includes a great deal of sensitive information about our code base, including e.g. our redis password. It is 2MB of text, so it is too large for me to manually redact all the sensitive information.

You should be able to reproduce for yourself by running bundle exec sidekiq -v on a sidekiq setup with sidekiq-scheduler. Any sidekiq version after 7.0.7 (sidekiq/sidekiq#5822 is required) should print the config object when started with -v and will thus trigger the inspect of the scheduler-manager.

I've had this same issue also because Sidekiq would print Sidekiq.options and the scheduler instance is in those options.
My notes say the problem is with the rufus scheduler having an array of rufus jobs which all have a reference to the rufus scheduler.

We fixed this by doing this in the initializer.

module SidekiqScheduler
  class Scheduler
    def inspect
      "#<#{self.class}:0x#{object_id.to_s(16)}>"
    end
  end
end