hugopl / sidekiq.cr

Simple, efficient job processing for Crystal
http://sidekiq.org
GNU Lesser General Public License v3.0
765 stars 74 forks source link

Issues connecting to Sidekiq Pro #102

Closed justmark closed 3 years ago

justmark commented 3 years ago

I have a Sidekiq Pro server running on the same host that I'm attempting to do some Crystal development on. The server has a password as well.

I'm running Crystal 0.36.1 currently. My Sidekiq.cr:

require "sidekiq/cli"
require "./workers/crystal_test_worker.cr"

cli = Sidekiq::CLI.new

server = cli.configure do |config|
  config.redis = Sidekiq::RedisConfig.new("127.0.0.1", 6379, db: 0, password: "some-really-long-password-here", pool_size: 30)
end

cli.run(server)

When I start up the system, I get the following output:

2021-03-24T19:37:22.291Z 27644 TID-1dtq4y7p0g Info: Sidekiq v0.6.1 in Crystal 0.36.1
2021-03-24T19:37:22.291Z 27644 TID-1dtq4y7p0g Info: Licensed for use under the terms of the GNU LGPL-3.0 license.
2021-03-24T19:37:22.291Z 27644 TID-1dtq4y7p0g Info: Starting processing with 25 workers
2021-03-24T19:37:22.291Z 27644 TID-1dtq4y7p0g Info: Press Ctrl-C to stop

If I change the password to an incorrect password, then the server output above is identical. I do have a worker in Crystal, which does have data in the queue (via Sidekiq Monitor application on the Ruby side).

My worker is:

require "sidekiq"

module SidekiqWorkers
  class CrystalTestWorker
    include Sidekiq::Worker
    sidekiq_options do |job|
      job.queue = "crystal_test_worker"
      job.retry = 5
    end

    def perform(system_id : Int32)
      puts "Got #{system_id}"
    end
  end
end

The queue name above is correct, and it does have data queued up. Regardless of what I try, I cannot seem to get it to connect. I also started it up with the verbose flag:

2021-03-24T19:37:42.547Z 27815 TID-1dk7dmfzog Info: Sidekiq v0.6.1 in Crystal 0.36.1
2021-03-24T19:37:42.547Z 27815 TID-1dk7dmfzog Info: Licensed for use under the terms of the GNU LGPL-3.0 license.
2021-03-24T19:37:42.547Z 27815 TID-1dk7dmfzog Info: Starting processing with 25 workers
2021-03-24T19:37:42.547Z 27815 TID-1dk7dmfzog Debug: #<Sidekiq::CLI:0x7f29da20a400 @logger=#<Log:0x7f29da20a3c0 @source="Sidekiq", @backend=#<Log::IOBackend:0x7f29da20a380 @dispatcher=#<Log::AsyncDispatcher:0x7f29da207c00 @channel=#<Channel(Tuple(Log::Entry, Log::Backend)):0x7f29da20a340>, @done=#<Channel(Nil):0x7f29da20a300>>, @io=#<IO::FileDescriptor: fd=3>, @formatter=Log::ProcFormatter(@proc=#<Proc(Log::Entry, IO, Nil):0x5621d645ea50>)>, @level=Debug, @initial_level=Info>, @concurrency=25, @queues=["default"], @timeout=8, @environment="development", @tag="">
2021-03-24T19:37:42.547Z 27815 TID-1dk7dmfzog Info: Press Ctrl-C to stop

Any thoughts as to what might be wrong?

Thanks.

hugopl commented 3 years ago

Could you try a simple hello world with redis to be sure the problem is the password protected connection?

Something like

require "redis"

redis = Redis.new(...)
pp! redis.keys("*")
justmark commented 3 years ago

Hi Hugopl,

Yeah, I'm getting an auth error.

redis.keys("*") # => Unhandled exception: NOAUTH Authentication required. (Redis::Error)

Mark

hugopl commented 3 years ago

So the issue seems to be related with your redis setup or the redis shard, not sidekiq.

hugopl commented 3 years ago

I'm closing this, since it seems to be a problem in your redis setup, not in sidekiq.