Log SMTP disconnect as warning instead of error

Bug #1613259 reported by Paul Everitt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KARL4
Fix Released
Low
Carlos de la Guardia

Bug Description

This is tripping Nagios alarms several times a week. Can we lower from warning to error?

Traceback (most recent call last):
  File "/srv/osfkarl/production/81/eggs/repoze.sendmail-4.2+agendaless.4-py2.7.egg/repoze/sendmail/queue.py", line 232, in _send_message
    self.mailer.send(fromaddr, toaddrs, message)
  File "/srv/osfkarl/production/81/eggs/repoze.sendmail-4.2+agendaless.4-py2.7.egg/repoze/sendmail/mailer.py", line 100, in send
    connection.sendmail(fromaddr, toaddrs, message)
  File "/usr/lib/python2.7/smtplib.py", line 748, in sendmail
    (code, resp) = self.data(msg)
  File "/usr/lib/python2.7/smtplib.py", line 511, in data
    (code, msg) = self.getreply()
  File "/usr/lib/python2.7/smtplib.py", line 365, in getreply
    + str(e))
SMTPServerDisconnected: Connection unexpectedly closed: ('The read operation timed out',)

Changed in karl4:
milestone: 022 → 023
Revision history for this message
Carlos de la Guardia (cguardia) wrote :

Where is this called? Is this the complete traceback? I can catch the exception inside repoze.sendmail, which should stop the errors, but there's no logging or anything set up in there, so not sure how I would log the warning.

Changed in karl4:
status: New → In Progress
Revision history for this message
Paul Everitt (paul-agendaless) wrote :

Yep, that's the entire traceback. I believe we've done this in the past, where we suppressed an unhandled repoze.sendmail traceback, but I don't remember how. Maybe we overrode the method in our implementation's subclass.

Changed in karl4:
milestone: 023 → 024
Changed in karl4:
milestone: 024 → 025
Revision history for this message
Carlos de la Guardia (cguardia) wrote :

Fixed, but turns out I don't have access to the repository. Sent a pull request:

https://github.com/karlproject/repoze.sendmail/pull/2

Changed in karl4:
status: In Progress → Fix Committed
Changed in karl4:
status: Fix Committed → Fix Released
Revision history for this message
Paul Everitt (paul-agendaless) wrote : Re: [Bug 1613259] Log SMTP disconnect as warning instead of error

Hmm, today I got four exceptions that looked like this:

Error while sending mail from to <email address hidden>.

Traceback (most recent call last):
  File "/srv/osfkarl/production/87/eggs/repoze.sendmail-4.2+agendaless.5-py2.7.egg/repoze/sendmail/queue.py", line 232, in _send_message
    self.mailer.send(fromaddr, toaddrs, message)
  File "/srv/osfkarl/production/87/eggs/repoze.sendmail-4.2+agendaless.5-py2.7.egg/repoze/sendmail/mailer.py", line 108, in send
    connection.quit()
  File "/usr/lib/python2.7/smtplib.py", line 772, in quit
    res = self.docmd("quit")
  File "/usr/lib/python2.7/smtplib.py", line 393, in docmd
    self.putcmd(cmd, args)
  File "/usr/lib/python2.7/smtplib.py", line 341, in putcmd
    self.send(str)
  File "/usr/lib/python2.7/smtplib.py", line 333, in send
    raise SMTPServerDisconnected('please run connect() first')
SMTPServerDisconnected: please run connect() first

> On Nov 30, 2016, at 10:01 PM, Carlos de la Guardia <email address hidden> wrote:
>
> Fixed, but turns out I don't have access to the repository. Sent a pull
> request:
>
> https://github.com/karlproject/repoze.sendmail/pull/2
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1613259
>
> Title:
> Log SMTP disconnect as warning instead of error
>
> Status in KARL4:
> In Progress
>
> Bug description:
> This is tripping Nagios alarms several times a week. Can we lower from
> warning to error?
>
> Traceback (most recent call last):
> File "/srv/osfkarl/production/81/eggs/repoze.sendmail-4.2+agendaless.4-py2.7.egg/repoze/sendmail/queue.py", line 232, in _send_message
> self.mailer.send(fromaddr, toaddrs, message)
> File "/srv/osfkarl/production/81/eggs/repoze.sendmail-4.2+agendaless.4-py2.7.egg/repoze/sendmail/mailer.py", line 100, in send
> connection.sendmail(fromaddr, toaddrs, message)
> File "/usr/lib/python2.7/smtplib.py", line 748, in sendmail
> (code, resp) = self.data(msg)
> File "/usr/lib/python2.7/smtplib.py", line 511, in data
> (code, msg) = self.getreply()
> File "/usr/lib/python2.7/smtplib.py", line 365, in getreply
> + str(e))
> SMTPServerDisconnected: Connection unexpectedly closed: ('The read operation timed out',)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/karl4/+bug/1613259/+subscriptions

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

I'll take a look Saturday morning.

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

I made another PR to fix this.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.