Closed ixti closed 8 months ago
Correction. Sidekiq::Rails::Reloader
is not the direct problem here. It simply holds instance variable: @app = Rails.application
. Calling Rails.application.as_json
fails with stack level to deep.
Rails extends Object
with as_json
:
class Object
def as_json(options = nil) # :nodoc:
if respond_to?(:to_hash)
to_hash.as_json(options)
else
instance_values.as_json(options)
end
end
end
Thus, if class does not implement to_hash
or as_json
, it will:
class Example
def initialize
@answer = 42
end
end
Example.new.as_json # => { "answer" => 42 }
TLDR; Sorry for the noise. This has nothing to do with SemanticLogger - will open a PR to Sidekiq.
Environment
Expected Behavior
Actual Behavior
Root Cause
Sidekiq 7.2 logs debug info about the process with payload:
The problematic here is
:reloader
. Attempt to callas_json
on it causes stack overflow.Workaround
We've monkey-patched
Sidekiq::Rails::Reloader
in our codebase to overcome this: