0
votes

In our Rails application we use Sidekiq to run jobs that builds iOS apps.

The jobs call code that basically SSH onto a server and call a script to do various things such as generating files, exporting packages, and uploading apps to S3, etc.

At one point we had some issues with the server and the jobs are stuck under Busy (see screenshot).

We have tried multiple ways to try and remove these very dead jobs but they still exist.

enter image description here

Weirdly they don't even show up in the count on the queue:

queue = Sidekiq::Queue.new('ios')
queue.count

On both servers this returns 0 even though you can see them on the Web UI.

We have also tried:

require 'sidekiq/api'
Sidekiq::Queue.new('ios').clear
Sidekiq::Queue.new.clear

And the more aggressive full clearing of Redis:

Sidekiq.redis(&:flushdb)

But those Busy Jobs are still present...

We have even resorted to killing the threads themselves with:

# web3
Thread.list.map { |t| t.exit if t.object_id.to_s == 'xb69d' }

# web4
Thread.list.map { |t| t.exit if t.object_id.to_s == 'oxjjfzr2p' }

But those Jobs are still there in the UI... How can we kill them?

We're aware of: https://github.com/mperham/sidekiq/wiki/FAQ#how-do-i-cancel-a-sidekiq-job but these are jobs that have already been run and we can't now do anything in the application code to cancel them, so we need a solution to remove them alternatively.

1
We can stop sidekiq process then these busy jobs will place into Enqueued job. In Enqueued section we have option to delete the jobs. - Amol Udage
Not sure the odds of me stumbling onto this question while researching a complex inter-process sidekiq active job queue prefix issue... - Paul Ridgway

1 Answers

0
votes

Jobs in progress are not enqueued; enqueued jobs haven't been started yet. You are looking for the Sidekiq::Workers API.

https://github.com/mperham/sidekiq/blob/2f049eae5df957786c4e9c0b5b32e0a5acc1c7d1/lib/sidekiq/api.rb#L900-L918