Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sidekiq not processing queue

What possible reasons can Sidekiq prevent from processing jobs in the queue? The queue is full. The log file sidekiq.log indicates no activity at all. Thus the queue is full but the log is empty, and Sidekiq does not seem to process items. There seem to no worker processing jobs. Restarting Redis or flush it with FLUSHALL or FLUSHDB as no effect. Sidekiq has been started with

bundle exec sidekiq -L log/sidekiq.log

and produces the following log file:

2013-05-30..Booting Sidekiq 2.12.0 using redis://localhost:6379/0 with options {} 2013-05-30..Running in ruby 1.9.3p374 (2013-01-15 revision 38858) [i686-linux] 2013-05-30..See LICENSE and the LGPL-3.0 for licensing details. 2013-05-30..Starting processing, hit Ctrl-C to stop 

How can you find out what went wrong? Are there any hidden log files?

like image 674
0x4a6f4672 Avatar asked May 30 '13 12:05

0x4a6f4672


People also ask

Is Sidekiq a queue?

Out-of-the-box Sidekiq uses a single queue named "default," but it's possible to create and use any number of other named queues if there is at least one Sidekiq worker configured to look at every queue.

How do Sidekiq queues work?

It works the same way as the scheduled queue; it contains jobs that have to be executed at a given time in the future. The main difference is that in retries queue, jobs are added by the Sidekiq, and the time when the job should be executed is calculated based on the retries counter.

How do I manually run a Sidekiq job?

To run sidekiq, you will need to open a terminal, navigate to your application's directory, and start the sidekiq process, exactly as you would start a web server for the application itself. When the command executes you will see a message that sidekiq has started.

Should I use Activejob Sidekiq?

If you build a web application you should minimize the amount of time spent responding to every user; a fast website means a happy user.


1 Answers

The reason was in our case: Sidekiq may look for the wrong queue. By default Sidekiq uses a queue named "default". We used two different queue names, and defined them in config/sidekiq.yml

# configuration file for Sidekiq :queues:   - queue_name_1   - queue_name_2 

The problem is that this config file is not automatically loaded by default in your development environment (unlike database.yml or thinking_sphinx.yml for instance) by a simple bundle exec sidekiq command. Thus we wrote our jobs in two certain queues, and Sidekiq was waiting for jobs in a third queue (the default one). You have to pass the path to the config file as a parameter through the -Cor --config option:

bundle exec sidekiq -C ./config/sidekiq.yml 

or you can pass the queue names directly (no spaces allowed here after the comma):

bundle exec sidekiq -q queue_name_1,queue_name_2 

To find the problem out it is helpful to pass the option -v or --verbose at the command line, too, or to use :verbose: true in the sidekiq.yml file. Everything which is defined in a config file is of course useless if the config file is not loaded.. Therefore make sure you are using the right config file first.

like image 187
0x4a6f4672 Avatar answered Sep 22 '22 05:09

0x4a6f4672