5

Ruby version: 2.3.1

Sidekiq / Pro / Enterprise version(s): 5.0

Rails: 5.0.2

I've followed this tutorial so I could use sidekiq to send emails in my rails api app. The app is published on AWS ElasticBeanstalk with Puma.

When an user registers, they should receive an email (through devise). No error is shown, no log at sidekiq.log is generated. I don't know what is going on, the emails simply aren't delivered.

initializers/devise_async.rb

Devise::Async.setup do |config|
  config.enabled = true
  config.backend = :sidekiq
  config.queue   = :default
end

initializers/sidekiq.rb

rails_root = Rails.root || File.dirname(__FILE__) + '/../..'
rails_env = Rails.env || 'development'
redis_config = YAML.load_file(rails_root.to_s + '/config/redis.yml')
redis_config.merge! redis_config.fetch(Rails.env, {})
redis_config.symbolize_keys!
Sidekiq.configure_server do |config|
  config.redis = { url: "redis://#{redis_config[:host]}:#{redis_config[:port]}/12" }
end
Sidekiq.configure_client do |config|
  config.redis = { url: "redis://#{redis_config[:host]}:#{redis_config[:port]}/12" }
end

config/redis.yml

development:
 host: 'localhost'
 port: '6379'
test:
 host: 'localhost'
 port: '6379'
production:
 host: 'xxxxx-xxxx-xxx.xxxxxx.xx.0001.sae1.cache.amazonaws.com'
 port: '6379'

config/sidekiq.yml

:concurrency: 5
:queues:
  - default

Last sidekiq log lines:

2017-05-06T02:16:10.579Z 8388 TID-grwqwpuzw INFO: Received USR1, no longer accepting new work
2017-05-06T02:16:10.584Z 8399 TID-gp30plzqo INFO: Received USR1, no longer accepting new work

Last nginx log lines:

172.31.14.103 - - [06/May/2017:02:20:51 +0000] "POST /v1/auth/ HTTP/1.1" 200 271 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36"

2017/05/06 02:16:22 [warn] 15902#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2017/05/06 02:16:22 [warn] 15909#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2017/05/06 02:16:22 [warn] 15950#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2017/05/06 02:16:22 [warn] 15957#0: conflicting server name "localhost" on 0.0.0.0:80, ignored

Last puma log lines:

[11765] - Gracefully shutting down workers...
[11765] === puma shutdown: 2017-05-06 02:16:23 +0000 ===
[11765] - Goodbye!
=== puma startup: 2017-05-06 02:16:26 +0000 ===
=== puma startup: 2017-05-06 02:16:26 +0000 ===
/var/app/current/app/serializers/notification_serializer.rb:20: warning: redefining `object_id' may cause serious problems
[16011] - Worker 0 (pid: 16014) booted, phase: 0

It works fine on local machine.

Do you have some ideas?

Pasp Ruby
  • 957
  • 1
  • 9
  • 22
  • according to the Sidkeiq log, Sidekiq is not accepting jobs because it received USR1. Have you tried terminating the Sidekiq workers and restarting? – Lukas Eklund May 12 '17 at 22:10
  • If I understood tutorial right, every new deploy it restarts sidekiq service and then "kill -USR1 `cat ${PIDFILE}`". Any new thoughts? – Pasp Ruby May 13 '17 at 14:17
  • `USR1` will stop sidekiq from accepting jobs but it doesn't restart sidekiq. The script will call `mute_sidekiq` pre deploy and post deploy is should call `restart_sidekiq` but based on the logs it doesn't seem to be calling `restart` – Lukas Eklund May 18 '17 at 18:12
  • did you figure this out? – Arel Aug 18 '18 at 05:43

0 Answers0