Rails mail: Errno :: EPIPE - PullRequest
       0

Rails mail: Errno :: EPIPE

1 голос
/ 05 марта 2020

Мы используем класс c Rails архитектуры

  • AWS EC2 в качестве хоста веб-сервера
  • AWS ElastiCache в качестве кэша
  • Puma
  • Sidekiq

Когда в нашем приложении произошли какие-то уведомления, наше веб-приложение отправит уведомление по электронной почте нашему клиенту через задание Sidekiq. Проблема в том, что наш инструмент мониторинга показывает, что с нашей работой по отправке электронной почты в производственной среде происходит множество ошибок Errno::EPIPE.

enter image description here

трассировка ошибок

Errno::EPIPE
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/openssl/buffering.rb:325:in `syswrite'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/openssl/buffering.rb:325:in `do_write'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/openssl/buffering.rb:449:in `flush'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/smtp.rb:909:in `ensure in block in data'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/smtp.rb:910:in `block in data'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/smtp.rb:960:in `critical'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/smtp.rb:898:in `data'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/smtp.rb:659:in `block in send_message'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/smtp.rb:854:in `rcptto_list'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/smtp.rb:659:in `send_message'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp_connection.rb:54:in `deliver!'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:101:in `block in deliver!'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/smtp.rb:519:in `start'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:109:in `start_smtp_session'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:2159:in `do_delivery'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:260:in `block in deliver'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/actionmailer-5.1.7/lib/action_mailer/base.rb:558:in `block in deliver_mail'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications.rb:166:in `block in instrument'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications.rb:166:in `instrument'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/actionmailer-5.1.7/lib/action_mailer/base.rb:556:in `deliver_mail'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:260:in `deliver'
/home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/delegate.rb:83:in `method_missing'
/var/www/small_app/releases/20200305040938/app/jobs/email_notifications_job.rb:13:in `perform'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activejob-5.1.7/lib/active_job/execution.rb:37:in `block in perform_now'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/callbacks.rb:108:in `block in run_callbacks'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/i18n-1.7.0/lib/i18n.rb:297:in `with_locale'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activejob-5.1.7/lib/active_job/translation.rb:7:in `block (2 levels) in <module:Translation>'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/callbacks.rb:117:in `instance_exec'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activejob-5.1.7/lib/active_job/logging.rb:24:in `block (4 levels) in <module:Logging>'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications.rb:166:in `block in instrument'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications.rb:166:in `instrument'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activejob-5.1.7/lib/active_job/logging.rb:23:in `block (3 levels) in <module:Logging>'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activejob-5.1.7/lib/active_job/logging.rb:44:in `block in tag_logger'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/tagged_logging.rb:69:in `block in tagged'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/tagged_logging.rb:26:in `tagged'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/tagged_logging.rb:69:in `tagged'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activejob-5.1.7/lib/active_job/logging.rb:44:in `tag_logger'
/var/www/small_app/shared/bundle/ruby/2.5.0/gems/activejob-5.1.7/lib/active_job/logging.rb:20:in `block (2 le...

Код Souce

class EmailNotificationsJob < ApplicationJob
  queue_as :default

  def perform(ntf_id)
    UserMailer.notification(ntf_id).deliver
  end
end

Информация об ОС

NAME="Amazon Linux AMI"
VERSION="2016.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2016.09"
PRETTY_NAME="Amazon Linux AMI 2016.09"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2016.09:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

Кажется, ошибка системного уровня или уровня библиотеки, а не ошибка уровня приложения.

  • Постановка env выглядит хорошо, почему это происходит только с нашим рабочим узлом EC2?
  • Как это исправить?
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...