ruby on rails - Sidekiq Terminates Silently When Using Remote Redis URL in Azure Container App (No Errors Logged) - Stack Overfl

admin2025-05-01  0

Versions

Ruby version: 3.2.6 Rails version: 7.2.2 Sidekiq / Pro / Enterprise version(s): Sidekiq 7.3.5

Problem

Sidekiq terminates immediately silently after initialization logs when using a remote Redis URL in an Azure Container App. The process does not log any errors, and the Redis connection is confirmed to be working via rails console. The issue does not occur when using a local Redis instance.

Expected Behavior

Sidekiq should start and remain running, processing background jobs.

Actual Behavior

Sidekiq terminates immediately after:

2025-01-02T13:00:30.663Z pid=27 tid=4k7 INFO: Booted Rails 7.2.2 application in staging environment
2025-01-02T13:00:30.663Z pid=27 tid=4k7 INFO: Running in ruby 3.2.6 (2024-10-30 revision 63aeb018eb) [x86_64-linux]
2025-01-02T13:00:30.663Z pid=27 tid=4k7 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2025-01-02T13:00:30.663Z pid=27 tid=4k7 INFO: Upgrade to Sidekiq Pro for more features and support: 
2025-01-02T18:18:36.577Z pid=27 tid=4k7 INFO: Sidekiq 7.3.5 connecting to Redis with options {:size=>10, :pool_name=>"internal", :url=>"redis://:[email protected]:6379"}

Here is my entrypoint code

bundle exec rails s -d
echo "Sidekiq should start here"
bundle exec sidekiq -C /myapp/config/sidekiq.yml

And here is my sidekiq.rb

Sidekiq.configure_server do |config|
  config.redis = { url: ENV['REDIS_URL'] || 'redis://localhost:6379' }
end

Sidekiq.configure_client do |config|
  config.redis = { url: ENV['REDIS_URL'] || 'redis://localhost:6379' }
end

And here is my sidekiq.yml

# Sample configuration file for Sidekiq.
# Options here can still be overridden by cmd line args.
# Place this file at config/sidekiq.yml and Sidekiq will
# pick it up automatically.
---
:verbose: false
:concurrency: 10
:timeout: 25

:queues:
  - critical
  - default
  - low
  - exports
  - mailer

production:
  :concurrency: 25
staging:
  :concurrency: 25
development:
  :concurrency: 15

***Update

I tried to get some debug info using at_exit method in sidekiq and here is the output

Error Information:
Exit Status: 1
Error Class: SystemExit
Error Message: exit
Backtrace:
/usr/local/bundle/gems/bundler-2.3.6/lib/bundler/friendly_errors.rb:110:in `exit'
/usr/local/bundle/gems/bundler-2.3.6/lib/bundler/friendly_errors.rb:110:in `rescue in with_friendly_errors'
/usr/local/bundle/gems/bundler-2.3.6/lib/bundler/friendly_errors.rb:101:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.3.6/exe/bundle:36:in `<top (required)>'
/usr/local/bundle/bin/bundle:25:in `load'
/usr/local/bundle/bin/bundle:25:in `<main>'

It seems like the bundler terminates the sidekiq process

Questions

Any ideas to understand what is happening or what is the error ?

Are there known issues with remote Redis?

Could this be related to Azure Container Apps?

How can I enable more detailed logging to debug this?

转载请注明原文地址:http://anycun.com/QandA/1746102627a91702.html