-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Sidekiq::Config#as_json causes StackLevelTooDeep error #6000
Comments
Why does this only happen with rails_semantic_logger? I was under the impression it only happens if the Oj gem is activated. In that case, I consider it an Oj issue. |
Thanks for the quick reply! The connection to rails_semantic_logger is incidental. The culprit is the implementation of |
Got it, so there is a simple workaround by putting that monkeypatch in your initializer. I don’t really like your suggestion as it feels magical, I put a delegator in and the error goes away. Feels very random. I think I might prefer to only log the options as suggested earlier or exclude the reloader. Either way should fix the issue. |
Alright I will go with the initializer. Thank you for your time 👍 |
Hi there!
I know this is not a sidekiq issue per se, since
as_json
is a method fromActiveSupport
but the solution seems to be easily fixable here.First of all, how to replicate this:
This happened to us while using https://github.com/reidmorrison/rails_semantic_logger in conjunction with sidekiq.
In the
Sidekiq::Launcher#run
method the config is loggedThe SemanticLogger (when using the Json formatter) will then try to call
as_json
on theSidekiq::Config
value, causing the crash. This is not that serious because (in our case) the error is only thrown in the logging thread, which resumes fine afterwards.For reference the
as_json
implementation from active_support:My proposed solution would be to add the following to
Sidekiq::Config
:Then
Sidekiq::Config#as_json
would behave similar toSidekiq::Config#to_json
and since only@options
is rendered, no recursion happens.Feel free to close the issue if you feel like this isn't sidekiqs problem.
The text was updated successfully, but these errors were encountered: