Git Product home page Git Product logo

Comments (15)

mperham avatar mperham commented on September 24, 2024

Your job payload has enqueued_at as a String rather than a Float as Sidekiq expects it. How did you created the job?

from sidekiq.

kapso avatar kapso commented on September 24, 2024

@mperham here's how

SlackPostMessageWorker.perform_async({ channel: '#server-events', blocks: }.deep_stringify_keys)

Sidekiq config

# Web Dashboard
require 'sidekiq/pro/web'
require 'sidekiq-scheduler'
require 'sidekiq-scheduler/web'

Sidekiq.configure_client do |config|
  config.redis = { url: Settings.redis.url, ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE } }
  config.logger.level = Rails.env.development? ? Logger::INFO : Logger::WARN

  # Sidekiq Pro options
  Sidekiq::Client.reliable_push! unless Rails.env.test?

  # Sidekiq Unique Jobs options
  config.client_middleware do |chain|
    chain.add SidekiqUniqueJobs::Middleware::Client
  end
end

Sidekiq.configure_server do |config|
  config.redis = { url: Settings.redis.url, ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE } }
  config.logger.level = Rails.env.development? ? Logger::INFO : Logger::WARN

  # Default is 5
  config.average_scheduled_poll_interval = 2

  config.on(:startup) do
    Sidekiq.schedule = YAML.safe_load(ERB.new(Rails.root.join('config/schedule.yml').read).result)
    SidekiqScheduler::Scheduler.instance.reload_schedule!
  end

  # Sidekiq Pro options
  Sidekiq::Client.reliable_push! unless Rails.env.test?
  config.super_fetch!
  config.reliable_scheduler!

  # Sidekiq Unique Jobs options
  config.client_middleware do |chain|
    chain.add SidekiqUniqueJobs::Middleware::Client
  end

  config.server_middleware do |chain|
    chain.add SidekiqUniqueJobs::Middleware::Server
  end

  SidekiqUniqueJobs::Server.configure(config)
  SidekiqUniqueJobs.config.lock_info = true
end

if Rails.env.staging? || Rails.env.production?
  Sidekiq::Web.use Rack::Auth::Basic do |username, password|
    username == Settings.sidekiq.admin.username && password == Settings.sidekiq.admin.password
  end
end

from sidekiq.

mperham avatar mperham commented on September 24, 2024

I think you'll need to show us the exact job payload. Can you get it out of Redis with redis-cli?

from sidekiq.

kapso avatar kapso commented on September 24, 2024

@mperham these are the arguments "gid://tradespace/SomeModel/725", "some_field_name" and its a basic Sidekiq worker (Sidekiq::Job).

how can I get the "exact payload"?

from sidekiq.

mperham avatar mperham commented on September 24, 2024

If the job is enqueued in the default queue, you'd use redis-cli like this:

redis-cli lindex queue:default 0

If the job is a retry, you'd need to use a more complex ZRANGE command.

from sidekiq.

kapso avatar kapso commented on September 24, 2024

@mperham we are seeing these weird errors with ActionMailbox::RoutingJob as well. (see screenshots below)

This happens during retries - and after a retry we loose the original error context, and start seeing re-queueing errors instead. Happening for ActiveJobs, and jobs based on Sidekiq::Job.

So I ran redis-cli -h <<MY_REDIS_SERVER>> -p <<REDIS_PORT>> -a <<MY_REDIS_PASSWORD>> lindex queue:default 0

and got the following response...

Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
(nil)
Screenshot 2024-05-30 at 6 02 00 PM Screenshot 2024-05-30 at 5 25 55 PM

from sidekiq.

kapso avatar kapso commented on September 24, 2024

@mperham this is happening a lot for us. Anything we can do on our side to fix this issue?

Whenever a job fails, it lands in Retries and then you click on a link in Next Retry column, we see an error. (stack trace - see above).

from sidekiq.

mperham avatar mperham commented on September 24, 2024

The issue is that you haven't shown me how to reproduce the problem. I can create both native Sidekiq::Jobs and ActiveJobs which crash and render fine when I go to their retry page. I can't really understand how best to fix the problem if I don't understand how the unexpected data format is getting into Redis in the first place.

from sidekiq.

kapso avatar kapso commented on September 24, 2024

@mperham what kind of data can I provide to help you replicate this?

from sidekiq.

mperham avatar mperham commented on September 24, 2024

I've already asked for the job payload. Your initializer would also be helpful.

from sidekiq.

kapso avatar kapso commented on September 24, 2024

@mperham already shared my Sidekiq config/initializer (see above).

Is it possible to share the ZRANGE command? I am not well versed with Redis or Sidekiq internals.

from sidekiq.

mperham avatar mperham commented on September 24, 2024

If you can give me the exact URL of a retry which crashes, I can give you the ZRANGE command to pull out that data.

from sidekiq.

kapso avatar kapso commented on September 24, 2024

@mperham here - */sidekiq/retries/1717471278.092402-0aa5dcc8678e3bc4bec102b0

from sidekiq.

mperham avatar mperham commented on September 24, 2024

redis-cli "zrange" "retry" "1717471278.092402" "1717471278.092402" "BYSCORE" "withscores"

Obviously you'll need to add the parameters to connect to your production instance.

from sidekiq.

mperham avatar mperham commented on September 24, 2024

If you run redis-cli monitor in a local Terminal, you can see the redis commands that Sidekiq runs as you use it on your machine; you can click around the Web UI and see the corresponding commands.

from sidekiq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.