End of File Reached &

222 views
Skip to first unread message

George Bofysil

unread,
Sep 13, 2015, 4:11:00 PM9/13/15
to Sidekiq

Hi,


I recently installed the Sidekiq gem to send emails in a background process in my Rails app. I have yet to get an email to send in development however and Stack Overflow searches have left me empty handed so far. I don't have a good grasp of Sidekiq or Redis so part of the problem is that I don't really know what to search for or how to interpret the error messages. The emails send just fine normally without Sidekiq using the .deliver method.


I'm getting two error messages "Connection reset by peer" and "End of file reached" that seem to alternate randomly. There's also a warning message that contains 'sysread_nonblock' and mentions the openssl directory. 


2015-09-13T01:59:23.751Z 1400 TID-owidkv8b8 WARN: Errno::ECONNRESET: Connection reset by peer
2015-09-13T01:59:23.751Z 1400 TID-owidkv8b8 WARN: /Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:182:in `sysread_nonblock'

Here's my code:


Rails 4.2.3,
Ruby 2.2.1


Gemfile

gem 'redis'
gem 'sidekiq'


Application.rb

config.active_job.queue_adapter = :sidekiq

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }

config.action_mailer.delivery_method = :smtp

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


Question Controller

QuestionMailer.question_email.deliver_later!


Question Mailer

default from: "in...@example.com"

def question_email
    mail(to: "exa...@gmail.com", subject: 'Question Email')
end


When I start my local server, I do the following:


Start Redis Server

redis-server /usr/local/etc/redis.conf


Start Sidekiq

bundle exec sidekiq -q default -q mailers


Start Rails Server (with foreman)

foreman run rails server

Here's my full log:


2015-09-13T01:59:17.861Z 1400 TID-owidkv8b8 ActionMailer::DeliveryJob JID-2fb2df2aac71bb896b05c7f1 INFO: start
2015-09-13T01:59:23.750Z 1400 TID-owidkv8b8 ActionMailer::DeliveryJob JID-2fb2df2aac71bb896b05c7f1 INFO: fail: 5.889 sec
2015-09-13T01:59:23.751Z 1400 TID-owidkv8b8 WARN: {"class"=>"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper", "wrapped"=>"ActionMailer::DeliveryJob", "queue"=>"mailers", "args"=>[{"job_class"=>"ActionMailer::DeliveryJob", "job_id"=>"708d1ee4-7d66-493e-8b9f-0fefa7838262", "queue_name"=>"mailers", "arguments"=>["QuestionMailer", "question_email", "deliver_now!"]}], "retry"=>true, "jid"=>"2fb2df2aac71bb896b05c7f1", "created_at"=>1442109557.85662, "enqueued_at"=>1442109557.8567731, "error_message"=>"Connection reset by peer", "error_class"=>"Errno::ECONNRESET", "failed_at"=>1442109563.749469, "retry_count"=>0}
2015-09-13T01:59:23.751Z 1400 TID-owidkv8b8 WARN: Errno::ECONNRESET: Connection reset by peer
2015-09-13T01:59:23.751Z 1400 TID-owidkv8b8 WARN: /Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:182:in `sysread_nonblock'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:182:in `read_nonblock'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/protocol.rb:153:in `rbuf_fill'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/protocol.rb:134:in `readuntil'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/protocol.rb:144:in `readline'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:945:in `recv_response'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:931:in `block in getok'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:955:in `critical'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:929:in `getok'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:923:in `quit'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:616:in `do_finish'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:523:in `ensure in start'
/Users/george/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:523:in `start'
/Users/george/.rvm/gems/ruby-2.2.1/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
/Users/george/.rvm/gems/ruby-2.2.1/gems/mail-2.6.3/lib/mail/message.rb:252:in `deliver!'
/Users/george/.rvm/gems/ruby-2.2.1/gems/actionmailer-4.2.3/lib/action_mailer/message_delivery.rb:77:in `deliver_now!'
/Users/george/.rvm/gems/ruby-2.2.1/gems/actionmailer-4.2.3/lib/action_mailer/delivery_job.rb:10:in `perform'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activejob-4.2.3/lib/active_job/execution.rb:32:in `block in perform_now'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:553:in `block (2 levels) in compile'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:496:in `block (2 levels) in around'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:341:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:341:in `block (2 levels) in simple'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activejob-4.2.3/lib/active_job/logging.rb:23:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activejob-4.2.3/lib/active_job/logging.rb:23:in `block (4 levels) in <module:Logging>'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `instrument'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activejob-4.2.3/lib/active_job/logging.rb:22:in `block (3 levels) in <module:Logging>'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activejob-4.2.3/lib/active_job/logging.rb:43:in `block in tag_logger'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `tagged'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activejob-4.2.3/lib/active_job/logging.rb:43:in `tag_logger'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activejob-4.2.3/lib/active_job/logging.rb:19:in `block (2 levels) in <module:Logging>'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:439:in `instance_exec'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:439:in `block in make_lambda'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:340:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:340:in `block in simple'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:495:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:495:in `block in around'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:88:in `run_callbacks'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activejob-4.2.3/lib/active_job/execution.rb:31:in `perform_now'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activejob-4.2.3/lib/active_job/execution.rb:21:in `execute'
/Users/george/.rvm/gems/ruby-2.2.1/gems/activejob-4.2.3/lib/active_job/queue_adapters/sidekiq_adapter.rb:42:in `perform'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/processor.rb:75:in `execute_job'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/processor.rb:52:in `block (2 levels) in process'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/logging.rb:30:in `with_context'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/middleware/chain.rb:132:in `call'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/middleware/chain.rb:132:in `invoke'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/processor.rb:51:in `block in process'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/processor.rb:98:in `stats'
/Users/george/.rvm/gems/ruby-2.2.1/gems/sidekiq-3.5.0/lib/sidekiq/processor.rb:50:in `process'
/Users/george/.rvm/gems/ruby-2.2.1/gems/celluloid-0.17.1.2/lib/celluloid/calls.rb:28:in `public_send'
/Users/george/.rvm/gems/ruby-2.2.1/gems/celluloid-0.17.1.2/lib/celluloid/calls.rb:28:in `dispatch'
/Users/george/.rvm/gems/ruby-2.2.1/gems/celluloid-0.17.1.2/lib/celluloid/call/async.rb:7:in `dispatch'
/Users/george/.rvm/gems/ruby-2.2.1/gems/celluloid-0.17.1.2/lib/celluloid/cell.rb:50:in `block in dispatch'
/Users/george/.rvm/gems/ruby-2.2.1/gems/celluloid-0.17.1.2/lib/celluloid/cell.rb:76:in `block in task'
/Users/george/.rvm/gems/ruby-2.2.1/gems/celluloid-0.17.1.2/lib/celluloid/actor.rb:339:in `block in task'
/Users/george/.rvm/gems/ruby-2.2.1/gems/celluloid-0.17.1.2/lib/celluloid/task.rb:44:in `block in initialize'
/Users/george/.rvm/gems/ruby-2.2.1/gems/celluloid-0.17.1.2/lib/celluloid/task/fibered.rb:14:in `block in create'


Many thanks in advance for any insights that can be provided!


Best, 

George

Mike Perham

unread,
Sep 13, 2015, 5:00:42 PM9/13/15
to sid...@googlegroups.com
Sounds like your SMTP information is wrong.  Can you send an email without Sidekiq via deliver_now?

--
You received this message because you are subscribed to the Google Groups "Sidekiq" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sidekiq+u...@googlegroups.com.
To post to this group, send email to sid...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sidekiq/55f4e1f7-5ecd-4b22-b9f8-f9ca6a2f60fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Mike Perham – CEO, Contributed Systems
Smart, effective open source infrastructure for your apps.

George Bofysil

unread,
Sep 13, 2015, 5:57:44 PM9/13/15
to Sidekiq
Hey Mike,

Yeah, deliver_now works perfectly fine which is why I assume there's something wrong with the redis/sidekiq configuration.
...
Reply all
Reply to author
Forward
0 new messages