简体   繁体   中英

End of file reached error at an email sent inside the sidekiq worker with Mailgun

I just started to get error messages of "end of file reached error" from email sent inside the sidekiq worker from couple days ago.

The below code is config setting for action mailer.

  config.app_domain = 'www.mydomain.com'
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.default_url_options = {host: config.app_domain }

  config.action_mailer.smtp_settings = {
    address: 'smtp.mailgun.org',
    port: '587',
    enable_starttls_auto: true,
    user_name: 'postmaster@mydomain.com',
    password: 'somepassword',
    authentication: :plain,
    domain: 'mydomain.com',
  }

It's weird to see most of emails are properly sent, but only few emails are being reported. However I'm not at the position being able to ignore these issues in case of a potential hazardous ramification.

Please share any thoughts, any ideas how to ideally manage this error.

Best

In ruby, sockets are IO objects. An EOFError (End of File error) is raised when an operation on the IO object references the end of the file.

The remote email server is closing the socket unexpectedly. If you want to ignore this type of error, you'll need to write your own Worker to replace Sidekiq's built-in ActionMailer delay extension. If you want make it silent, then you can do something like

begin
  # your code to send email here
rescue EOFError
 # retry by calling the same worker again(if required)
end

Have an alert on time-series based delivery failure alerts which can be on percentage or count of emails not being delivered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM