-
Notifications
You must be signed in to change notification settings - Fork 97
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
NoMethodError on Sidekiq jobs on Rails 6.0.3.2 #342
Comments
Could you try downgrading to scout apm 2.6.7 temporarily. I fixed another issue with Sidekiq, and I wonder if this is an unintended side effect. |
@hmatic Are you using ActiveJob, or "run-later" functionality in sidekiq? Trying to narrow down the situation you're seeing. Are you seeing this issue newly on an upgraded Rails? Which version are you coming from? |
I initially tried it on 2.6.0 and it was happening there aswell.
Yes, we're using activejob. |
Thank you for the report - something must have changed in the ActiveJob payload between the ... patch releases... of Rails. I'll take a look. |
@hmatic I am not able to reproduce this locally. I have a new Rails 6.0.3.2, with ActiveJob set to sidekiq, and Sidekiq 5.0.0. We capture the job name from Sidekiq's middleware API at https://github.com/scoutapp/scout_apm_ruby/blob/master/lib/scout_apm/background_job_integrations/sidekiq.rb#L88 When I put a debug line to dump
Where Next Steps1️⃣ Do you have any other sidekiq or activejob plugins that may be changing this payload? |
Hey @cschneid , sorry for late answer.
|
Hey @cschneid , any updates here? |
Any updates here? |
Hi @hmatic, sorry this got lost in the shuffle. Could you add a middleware to sidekiq that simply logs the parameters passed into it? There's something weird going on with the shape of the data we expect, and the data that's actually coming through. lib/sidekiq_dump_payload.rb
config/initializers/sidekiq.rb
Feel free to adjust to dump to a file or another log, we just need to see what data is coming through. Let me know what comes out, particularly in the msg.inspect section. Post here (redacting whatever is needed), or email us at [email protected]. |
Here's output of msg:
|
I'm running into the exact same issue! Followed the steps recommended above, I get similar results. My app is deployed to Heroku, using Scout as addon. Ruby 2.7.0, Rails 6.0.3.4 No errors before having my solution => remove |
A new observation I made lately: @cschneid It's easy to reproduce with ActionMailer: First, intentionally raise an error in one of the mailer methods: i.e. just add a first line in the method body like Then the 2 scenarios: scout_apm disabledComment out scout_apm enabledAdd scout_apm back in the Gemfile and deploy.
|
@cschneid and @hmatic There was a change in the Rails ActiveJob Sidekiq adapter which, by removing the With a gem like yajl-ruby, when the ActiveJob is enqueued to be sent to Sidekiq adapter which then pushes it serialized as JSON to redis, the It affects the stack to deep for scout_apm to do much about it, although there may be workarounds (like getting the job_class and name from the For my project, the fix was to just remove the |
This is the wrapper that gets used when you use ad-hoc backgrounding with `MyClass.delay.myfunc(1,2,3)` We were just getting the name of the wrapper, and now we expand it out and read off the name of the actual function being called.
Currently `wrapped` is a String. Instead pass Class so that Sidekiq can get access to the ActiveJob and its configuration without having to constantize. I verified that `JobClass.to_s` == `"JobClass"` so serialization to JSON should not be affected. ```ruby > JSON.dump({"wrapped" => SomeJob}) => "{\"wrapped\":\"SomeJob\"}" ``` By having access to the ActiveJob class, Sidekiq can get access to any `sidekiq_options` which have been set on that ActiveJob type and serialize those options into Redis. https://github.com/mperham/sidekiq/blob/master/Changes.md#60
@rcugut good catch, problem is that yajl-ruby is not something that we enabled, but it came with money-historical-bank gem, so not quite sure that I can just get rid of it. Not quite sure how to continue, seems like everyone is passing ball to others :) |
We have been trying to upgrade to Rails 6.0.3.2 and there's issue with scout apm while executing jobs. We're getting following error on every job:
NoMethodError: undefined method
downcase' for {}:Hash`Rails version: 6.0.3.2
Scout_apm version: 2.6.8
Sidekiq version: 5.0.0
Issue seems to be on this line:
https://github.com/scoutapp/scout_apm_ruby/blob/master/lib/scout_apm/job_record.rb#L67
Im not that familiar with inside implementation of scout apm gem, but layer should have string in its "name" variable, but it has Hash instead.
The text was updated successfully, but these errors were encountered: