2015-02-03 2 views
2

Я настроил почтовую программу с SMTP через Office 365, которая отлично работает без адаптера очередей. Однако, когда я начинаю работу в очереди, я получаю:DelayedJobAdapter терпит неудачу с EOFError: конец файла достигнут

Job ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper (id=2) 
FAILED (5 prior attempts) with EOFError: end of file reached 

Не уверен, если это имеет значение, но я бегу мой сервер через SSL.

Вот мой конфиг:

config.action_mailer.delivery_method = :smtp 
config.active_job.queue_adapter = :delayed_job 

config.action_mailer.smtp_settings = { 
address:    'smtp.office365.com', 
port:     587, 
user_name:   ENV['SMTP_USERNAME'], 
password:    ENV['SMTP_PASSWORD'], 
authentication:  :login, 
enable_starttls_auto: true 
} 

Контроллер:

SendEmailJob.set(wait: 5.seconds).perform_later 

Вот что видим в delayed_jobs sqlite3 таблице:

8|0|5|--- !ruby/object:ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper 
job_data: 
    job_class: ActionMailer::DeliveryJob 
    job_id: 2fb5924b-c1b5-4383-80cb-0c4b9c4300ce 
    queue_name: mailers 
    arguments: 
    - UserMailer 
    - welcome_email 
    - deliver_now 
|end of file reached 
/usr/lib/ruby/1.9.1/openssl/buffering.rb:174:in `sysread_nonblock' 
/usr/lib/ruby/1.9.1/openssl/buffering.rb:174:in `read_nonblock' 
/usr/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill' 
/usr/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil' 
/usr/lib/ruby/1.9.1/net/protocol.rb:132:in `readline' 
/usr/lib/ruby/1.9.1/net/smtp.rb:929:in `recv_response' 
/usr/lib/ruby/1.9.1/net/smtp.rb:915:in `block in getok' 
/usr/lib/ruby/1.9.1/net/smtp.rb:939:in `critical' 
/usr/lib/ruby/1.9.1/net/smtp.rb:913:in `getok' 
/usr/lib/ruby/1.9.1/net/smtp.rb:907:in `quit' 
/usr/lib/ruby/1.9.1/net/smtp.rb:613:in `do_finish' 
/usr/lib/ruby/1.9.1/net/smtp.rb:522:in `ensure in start' 
/usr/lib/ruby/1.9.1/net/smtp.rb:522:in `start' 
/usr/lib/ruby/gems/1.9.1/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!' 
/usr/lib/ruby/gems/1.9.1/gems/mail-2.6.3/lib/mail/message.rb:2141:in `do_delivery' 
/usr/lib/ruby/gems/1.9.1/gems/mail-2.6.3/lib/mail/message.rb:236:in `block in deliver' 
/usr/lib/ruby/gems/1.9.1/gems/actionmailer-4.2.0/lib/action_mailer/base.rb:543:in `block in deliver_mail' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `block in instrument' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `instrument' 
/usr/lib/ruby/gems/1.9.1/gems/actionmailer-4.2.0/lib/action_mailer/base.rb:541:in `deliver_mail' 
/usr/lib/ruby/gems/1.9.1/gems/mail-2.6.3/lib/mail/message.rb:236:in `deliver' 
/usr/lib/ruby/gems/1.9.1/gems/actionmailer-4.2.0/lib/action_mailer/message_delivery.rb:85:in `deliver_now' 
/usr/lib/ruby/gems/1.9.1/gems/actionmailer-4.2.0/lib/action_mailer/delivery_job.rb:10:in `perform' 
/usr/lib/ruby/gems/1.9.1/gems/activejob-4.2.0/lib/active_job/execution.rb:32:in `block in perform_now' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:117:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:117:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:338:in `block (2 levels) in simple' 
/usr/lib/ruby/gems/1.9.1/gems/activejob-4.2.0/lib/active_job/logging.rb:23:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/activejob-4.2.0/lib/active_job/logging.rb:23:in `block (4 levels) in <module:Logging>' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `block in instrument' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `instrument' 
/usr/lib/ruby/gems/1.9.1/gems/activejob-4.2.0/lib/active_job/logging.rb:22:in `block (3 levels) in <module:Logging>' 
/usr/lib/ruby/gems/1.9.1/gems/activejob-4.2.0/lib/active_job/logging.rb:43:in `block in tag_logger' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb:68:in `block in tagged' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb:26:in `tagged' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb:68:in `tagged' 
/usr/lib/ruby/gems/1.9.1/gems/activejob-4.2.0/lib/active_job/logging.rb:43:in `tag_logger' 
/usr/lib/ruby/gems/1.9.1/gems/activejob-4.2.0/lib/active_job/logging.rb:19:in `block (2 levels) in <module:Logging>' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:436:in `instance_exec' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:436:in `block in make_lambda' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:337:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:337:in `block in simple' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:92:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:92:in `_run_callbacks' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:734:in `_run_perform_callbacks' 
/usr/lib/ruby/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:81:in `run_callbacks' 
/usr/lib/ruby/gems/1.9.1/gems/activejob-4.2.0/lib/active_job/execution.rb:31:in `perform_now' 
/usr/lib/ruby/gems/1.9.1/gems/activejob-4.2.0/lib/active_job/execution.rb:21:in `execute' 
/usr/lib/ruby/gems/1.9.1/gems/activejob-4.2.0/lib/active_job/queue_adapters/delayed_job_adapter.rb:34:in `perform' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/backend/base.rb:94:in `block in invoke_job' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/backend/base.rb:91:in `invoke_job' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:204:in `block (2 levels) in run' 
/usr/lib/ruby/1.9.1/timeout.rb:69:in `timeout' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:204:in `block in run' 
/usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:203:in `run' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:280:in `block in reserve_and_run_one_job' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:280:in `reserve_and_run_one_job' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:187:in `block in work_off' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:186:in `times' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:186:in `work_off' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:150:in `block (4 levels) in start' 
/usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:149:in `block (3 levels) in start' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:148:in `block (2 levels) in start' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:147:in `loop' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:147:in `block in start' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/plugins/clear_locks.rb:7:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:79:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:79:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:79:in `block in add' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/worker.rb:146:in `start' 
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-4.0.6/lib/delayed/tasks.rb:9:in `block (2 levels) in <top (required)>' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in `call' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `each' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain' 
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `each' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:75:in `run' 
/usr/lib/ruby/gems/1.9.1/gems/rake-10.4.2/bin/rake:33:in `<top (required)>' 
/usr/local/bin/rake:23:in `load' 
/usr/local/bin/rake:23:in `<main>'|2015-02-03 01:01:39.509092||||mailers|2015-02-03 00:44:09.243109|2015-02-03 00:51:09.516624 

Ваша помощь будет принята с благодарностью ,

ответ

1

Оказалось, что я просто забыл настроить переменные env для своей учетной записи Office365. Они были настроены в apache2 envvars, но при запуске рейк-заданий: run они должны были быть настроены отдельно.

Мне удалось определить это, когда я попытался отправить через Google. И Google сказал, что аутентификация SMTP не удалась. Странно, что с Office365 он жалуется на EOFError.

Смежные вопросы