Skip to content
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

fix: Avoid JSON dump on Rails.application #6198

Merged
merged 1 commit into from Feb 15, 2024

Conversation

ixti
Copy link
Contributor

@ixti ixti commented Feb 15, 2024

Rails enhances Object with #as_json that either uses #to_hash, or builds Hash of instance variables to their values. During boot process Sidekiq sends debug event with context that includes :reloader. As Reloader class has @app = Rails.application that causes stak level too deep one-off failure.

Rails enhances `Object` with `#as_json` that either uses `#to_hash`, or
builds Hash of instance variables to their values. During boot process
Sidekiq sends debug event with context that includes `:reloader`. As
Reloader class has `@app = Rails.application` that causes stak level too
deep one-off failure.
@mperham
Copy link
Collaborator

mperham commented Feb 15, 2024

Can you point me to the Rails code that uses to_hash?

@mperham
Copy link
Collaborator

mperham commented Feb 15, 2024

@mperham
Copy link
Collaborator

mperham commented Feb 15, 2024

to_hash looks to be supported at least back to Rails 6.1.

@mperham mperham merged commit bccc8c2 into sidekiq:main Feb 15, 2024
11 checks passed
@ixti ixti deleted the fix-reloader-json-serialization branch February 15, 2024 23:32
@ixti
Copy link
Contributor Author

ixti commented Feb 15, 2024

@mperham yeah, 6.0 also uses to_hash. My initial idea was to define as_json but digging through ActiveSupport - I believe #to_hash is the best one. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants