shoryuken
                                
                                 shoryuken copied to clipboard
                                
                                    shoryuken copied to clipboard
                            
                            
                            
                        Post Ruby and Rails upgrade: Shoryuken worker polling shows no messages even when messages are present in SQS queue
Hi Team, Post upgrading my Ruby from 3.0.4 to 3.3.0 and Rails from 7.0.8 to 7.1.3.2, Shoryuken gem version is same 6.0.0, SQS Workers are not processing any messages in the queue, even when messages are present in the queue.
Upon checking the shoryuken verbose mode, I can see it's triggerring dispatch about , seems like it couldn't find any messages in the queue:
2024-05-05T13:46:51Z 80 TID-5r94 DEBUG: Looking for new messages in sqs_queue_name 
2024-05-05T13:47:11Z 80 TID-5r94 DEBUG: Fetcher for sqs_queue_name completed in 20008.652933 ms 
2024-05-05T13:47:11Z 80 TID-5r94 DEBUG: Paused sqs_queue_name 
2024-05-05T13:47:11Z 80 TID-5r80 DEBUG: Unpaused sqs_queue_name 
2024-05-05T13:47:11Z 80 TID-5r80 DEBUG: Firing 'dispatch' lifecycle event 
2024-05-05T13:47:11Z 80 TID-5r80 DEBUG: Ready: 16, Busy: 0, Active Queues: [["sqs_queue_name", 1], ["sqs_queue_name-2", 1]] 
I've checked an other post which suggests to use long polling, I've tried that as well, but it didn't work. This is my shoryuken.rb file
# frozen_string_literal: true
require 'shoryuken_custom_registry'
Shoryuken.configure_server do |config|
  config.sqs_client = Aws::SQS::Client.new(log_level: :debug)
  # Middleware Configs
  config.server_middleware do |chain|
    chain.add ClearWorkerThreadVariables
  end
end
Shoryuken.workerq_registry = ShoryukenCustomRegistry.new
I've tried with AWS CLI that my worker is able to connect to SQS and send and receive messages and when i downgrade the versions, it is working.
Can you please help me point in the direction where i should debug more?
@avinash8200 I have ran into the same issue. I haven't figured out the root cause but I have determined that bumping the aws-sdk-core was part of the issue.
Downgrading to aws-sdk-core (3.191.6) seems to have fixed the issue
@davidrichey I've tried the above, I'm still facing the same, shoryuken is not processing the messages.
@avinash8200 could you post your shoryuken versions as well as the aws gem versions you are using?
FWIW, I debugged my situation from utilizing the SQS UI to view that a message was sent and added pry's in the queue to confirm I wasn't receiving any messages.
@davidrichey Shoryuken version: 6.0.0 aws-sdk-rails: 3.1.0 aws-sdk-sqs: 1.26.0 aws-sdk-core: 3.191.6
Yeah, I have verified in SQS dashboard and polled from aws cli to check if messages are present in SQS queue and they are present. I have enabled verbose while starting shoryuken and from logs i can see that shoryuken is not receiving it.
Not sure this will help but here is what we are running:
aws-sdk-core (3.191.6)
aws-sdk-sqs (1.44.0)
shoryuken (5.3.2)
Let me once try that, thanks for the help and time, David.
Update: Tried above, still the issue persists.
I ran into the same problem and found that one of the causes is that it is not getting the list of available queues.
Shoryuken::Client.sqs.list_queues
This should return the list of queues, but the answer is:
#<struct Aws::SQS::Types::ListQueuesResult queue_urls=[], next_token=nil>
At the moment I am using a version lower than (3.191.6) in aws-sdk-core where this still works fine.
Thanks for filing this issue, this helped me a lot. We ran into the same issue.
I ended up with upgrading to the following gems:
- aws-sdk-core (3.197.0)<-- other/higher versions might work as well
- aws-sdk-sqs (1.75.0)<-- I think this is mainly the fix
On develop:
[1] pry(main)> credentials = <valid AWS credentials>
[2] pry(main)> client = Aws::SQS::Client.new(credentials: credentials)
=> #<Aws::SQS::Client>
[4] pry(main)> client.list_queues
=> #<struct Aws::SQS::Types::ListQueuesResult
 queue_urls=
  [],
 next_token=nil>
With fix:
[1] pry(main)> credentials = <valid AWS credentials>
[2] pry(main)> client = Aws::SQS::Client.new(credentials: credentials)
=> #<Aws::SQS::Client>
[4] pry(main)> client.list_queues
=> #<struct Aws::SQS::Types::ListQueuesResult
 queue_urls=
  ["https://sqs.<region>.amazonaws.com/sqs-queue-1",
   "https://sqs.<region>.amazonaws.com/sqs-queue-2",
   "https://sqs.<region>.amazonaws.com/sqs-queue-3",],
 next_token=nil>
This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.
This issue was closed because it hasn't seen activity for a while.