ruby on rails - Devise won't send email when unicorn worker_processes is 1 -


here's start of unicorn.rb

worker_processes 1 timeout integer 25 preload_app true ... 

with settings, when try password reset devise, in log (lightly edited security):

started post "/password" 127.0.0.1 @ 2015-06-02 13:21:56 -0700 processing devise::passwordscontroller#create    parameters: {"utf8"=>"✓", "authenticity_token"=>"(removed)", "user"=>{"email"=>"(removed)@(removed).com"}, "button"=>""}    rendered users/mailer/reset_password_instructions.html.slim within layouts/email (5.2ms)  devise::mailer#reset_password_instructions: processed outbound mail in 143.8ms unicorn fork complete. env['ar_db_pool_size']=, env['sidekiq_concurrency']=, rails configured 5. 

note last line. unicorn timed out , had restarted! (why?)

other processes send email work fine. devise seems affected.

after many hours of debugging determined if change unicorn use 2 or more worker_processes, problem goes away:

started post "/password" 127.0.0.1 @ 2015-06-02 14:21:05 -0700 processing devise::passwordscontroller#create    parameters: {"utf8"=>"✓", "authenticity_token"=>"(removed)", "user"=>{"email"=>"(removed)@(removed).com"}, "button"=>""}    rendered users/mailer/reset_password_instructions.html.slim within layouts/email (6.9ms)  devise::mailer#reset_password_instructions: processed outbound mail in 164.2ms  sent mail (removed)@(removed).com (878.1ms)  redirected http://localhost:5000/sign-in completed 302 found in 1405ms (activerecord: 24.2ms) 127.0.0.1 post /password 302 found devise::passwordscontroller#create html 1405.4 (db 24.2, view 0.0) {"utf8"=>"✓", "authenticity_token"=>"(removed)", "user"=>{"email"=>"(removed)@(removed).com"}, "button"=>""} {} body:   started "/sign-in" 127.0.0.1 @ 2015-06-02 14:21:07 -0700 processing devise::sessionscontroller#new    rendered users/shared/_links.slim (0.7ms)   rendered users/sessions/new.html.slim within layouts/application (3.3ms)   rendered shared/_flash.html.slim (0.5ms)   rendered global/_header.html.slim (1.4ms)   rendered global/_footer.html.slim (0.5ms)   rendered shared/_airbrake.html.slim (0.6ms)   rendered shared/_notifier.html.slim (0.4ms) completed 200 ok in 31ms (views: 30.2ms | activerecord: 0.0ms) 

success! (how?)

why have run 2+ unicorn web workers devise work properly? need fix devise work when have 1 instance of unicorn??

thanks help!

update: asked problem on devise issue tracker: https://github.com/plataformatec/devise/issues/3614 - we'll see venue figures out first :)

github user georgeguimaraes responded issue opened on devise issue tracker, , after dialog discovered stylesheet_link_tag method use load stylesheets in email template causing problem somehow making web call our web server (which busy trying send email) caused whole thing lock , die.

meanwhile, on stack overflow, 18 people saw question. oh well. investigation helps else someday.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -