Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Flaky way to check for job Klass in client_middleware.rb #157

Open
pgupta-jw opened this issue Aug 18, 2020 · 1 comment
Open

Flaky way to check for job Klass in client_middleware.rb #157

pgupta-jw opened this issue Aug 18, 2020 · 1 comment

Comments

@pgupta-jw
Copy link

pgupta-jw commented Aug 18, 2020

Hi

This line seems flaky way to check for the job Klass
https://github.com/utgarda/sidekiq-status/blob/master/lib/sidekiq-status/client_middleware.rb#L23

msg["args"][0] can return string, and if that string happens to start with "job_class" then we get "job_class" as klass and it fails later in Module.const_defined?(klass) because "job_class" is not a constant.

example:

> msg = {"args":["job_classification","plan_information","something else"]}
>msg["args"][0]["job_class"]
# returns "job_class"

Curious to know why klass = msg["args"][0]["job_class"] was put in there.

Thanks

@yunixon
Copy link

yunixon commented Sep 4, 2020

Hi

we have a class MatchAllRefsJob, but sidekiq status server middleware return Module

NameError: uninitialized constant Module::MatchAllRefsJob
  from sidekiq-status/server_middleware.rb:38:in `const_get'
  from sidekiq-status/server_middleware.rb:38:in `call'
  from sidekiq/middleware/chain.rb:130:in `block in invoke'
  from new_relic/agent/instrumentation/sidekiq.rb:33:in `block in call'
  from new_relic/agent/instrumentation/controller_instrumentation.rb:376:in `perform_action_with_newrelic_trace'
  from new_relic/agent/instrumentation/sidekiq.rb:29:in `call'
  from sidekiq/middleware/chain.rb:130:in `block in invoke'
  from raven/integrations/sidekiq.rb:9:in `call'
  from sidekiq/middleware/chain.rb:130:in `block in invoke'
  from sidekiq/failures/middleware.rb:9:in `call'
  from sidekiq/middleware/chain.rb:130:in `block in invoke'
  from sidekiq/middleware/chain.rb:133:in `invoke'
  from sidekiq/processor.rb:164:in `block in process'
  from sidekiq/processor.rb:137:in `block (6 levels) in dispatch'
  from sidekiq/job_retry.rb:109:in `local'
  from sidekiq/processor.rb:136:in `block (5 levels) in dispatch'
  from sidekiq/rails.rb:43:in `block in call'
  from active_support/execution_wrapper.rb:87:in `wrap'
  from active_support/reloader.rb:73:in `block in wrap'
  from active_support/execution_wrapper.rb:87:in `wrap'
  from active_support/reloader.rb:72:in `wrap'
  from sidekiq/rails.rb:42:in `call'

sidekiq (6.1.1)
sidekiq-status (1.1.4)

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

No branches or pull requests

2 participants