Project

General

Profile

Bug #24949

Don't traceback when unable to send email

Added by Alec Pearson over 1 year ago. Updated 11 months ago.

Status:
Resolved
Priority:
Nice to have
Assignee:
Sean Fagan
Category:
Middleware
Target version:
Seen in:
Sprint:
Severity:
New
Backlog Priority:
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
Yes
Needs Merging:
Yes
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:

HP Microserver G7

ChangeLog Required:
No

Description

A Traceback is generated if Internet Access is not available when routine mails are due to be sent.
Would it not be better to log an error message rather than a traceback ?

Traceback (most recent call last):
  File "/usr/local/www/freenasUI/common/system.py", line 274, in send_mail
    server = _get_smtp_server(timeout, local_hostname=local_hostname)
  File "/usr/local/www/freenasUI/common/system.py", line 197, in _get_smtp_server
    local_hostname=local_hostname)
  File "/usr/local/lib/python3.6/smtplib.py", line 1029, in __init__
    source_address)
  File "/usr/local/lib/python3.6/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/local/lib/python3.6/smtplib.py", line 335, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/local/lib/python3.6/smtplib.py", line 1035, in _get_socket
    self.source_address)
  File "/usr/local/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
emailreceived.png (22.1 KB) emailreceived.png Rishabh Chauhan, 11/07/2017 11:21 AM
emailsent.png (50.4 KB) emailsent.png Rishabh Chauhan, 11/07/2017 11:21 AM
tracebacksnotrelatedtoemail.png (137 KB) tracebacksnotrelatedtoemail.png Rishabh Chauhan, 11/10/2017 10:42 AM
12947
12948
13006

Associated revisions

Revision 195fb0c2 (diff)
Added by Sean Fagan over 1 year ago

Don't include traceback information when unable to send email.

Ticket: #24949

History

#1 Updated by Sean Fagan over 1 year ago

  • Status changed from Unscreened to Screened

Not sure why this went to me.

#2 Updated by Dru Lavigne over 1 year ago

  • Status changed from Screened to Unscreened
  • Assignee changed from Sean Fagan to Release Council

Alec: which build version (from System -> Information)?

#3 Updated by Dru Lavigne over 1 year ago

  • Status changed from Unscreened to 15

#4 Updated by Alec Pearson over 1 year ago

I have updated to 11.0-U1 now, but I think it was 11.0-RELEASE (a2dc21583)

#5 Updated by Dru Lavigne over 1 year ago

To clarify: you still get the traceback on U1?

#6 Updated by Alec Pearson over 1 year ago

I have not tried to break it.
The mails go out at 0300 and it just happened that the VPN went down that night.
Let me give it a go.....

#7 Updated by Alec Pearson over 1 year ago

  • Seen in changed from 11.0 to 11.0-U1

This is the traceback on FreeNAS-11.0-U1 (aa82cc58d)
I can now see that there is an error messaged generated but the Traceback is what catches the eye.....

Jul  6 17:19:40 freenas uwsgi: [common.system:293] Failed to send email: [Errno 8] hostname nor servname provided, or not known
Traceback (most recent call last):
  File "./freenasUI/common/system.py", line 274, in send_mail
    server = _get_smtp_server(timeout, local_hostname=local_hostname)
  File "./freenasUI/common/system.py", line 197, in _get_smtp_server
    local_hostname=local_hostname)
  File "/usr/local/lib/python3.6/smtplib.py", line 1029, in __init__
    source_address)
  File "/usr/local/lib/python3.6/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/local/lib/python3.6/smtplib.py", line 335, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/local/lib/python3.6/smtplib.py", line 1035, in _get_socket
    self.source_address)
  File "/usr/local/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/local/lib/pyth
Jul  6 17:19:40 freenas uwsgi: on3.6/socket.py", line 743, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] hostname nor servname provided, or not known

#8 Updated by Dru Lavigne over 1 year ago

  • Status changed from 15 to Unscreened
  • Assignee changed from Release Council to William Grzybowski

#9 Updated by William Grzybowski over 1 year ago

  • Status changed from Unscreened to Screened
  • Priority changed from No priority to Nice to have
  • Target version set to 11.2-BETA1

#10 Updated by Sean Fagan over 1 year ago

The traceback is part of the error message that is logged:

log.warn('Failed to send email: %s', errmsg, exc_info=True)

This is Behaves Correctly.

#11 Updated by William Grzybowski over 1 year ago

Sean Fagan wrote:

The traceback is part of the error message that is logged:

log.warn('Failed to send email: %s', errmsg, exc_info=True)

This is Behaves Correctly.

I beg to differ, IMO tracebacks should only be recorded to the specific facility and when it makes sense to have one.

#12 Updated by Sean Fagan over 1 year ago

Then get rid of the exc_info=True, and it's done I guess.

I, personally, want to know where and why it failed, but I'm not the normal user, so...

#13 Updated by William Grzybowski over 1 year ago

Sean Fagan wrote:

Then get rid of the exc_info=True, and it's done I guess.

I, personally, want to know where and why it failed, but I'm not the normal user, so...

Do you want to take care of this ticket? I can hand over to you. I have too many already :)

#14 Updated by Sean Fagan over 1 year ago

  • Assignee changed from William Grzybowski to Sean Fagan

For just that change? Sure. I was already looking into it, somewhat obviously :).

#15 Updated by Sean Fagan over 1 year ago

  • Status changed from Screened to Needs Developer Review

Simple change, over to William for review, in the branch FIX-24949

#16 Updated by Dru Lavigne about 1 year ago

  • Assignee changed from Sean Fagan to William Grzybowski

#17 Updated by William Grzybowski about 1 year ago

  • Status changed from Needs Developer Review to Reviewed by Developer

#18 Updated by Dru Lavigne about 1 year ago

  • Subject changed from Traceback Generated if Internet access is not available when routine mails are sent to Don't traceback when unable to send email
  • Target version changed from 11.2-BETA1 to 11.1

#19 Updated by William Grzybowski about 1 year ago

  • Assignee changed from William Grzybowski to Sean Fagan

#20 Updated by Dru Lavigne about 1 year ago

  • Status changed from Reviewed by Developer to Ready For Release
  • Target version changed from 11.1 to 11.1-BETA1

#21 Updated by Dru Lavigne 12 months ago

  • Status changed from Ready For Release to Resolved

#22 Updated by Rishabh Chauhan 11 months ago

12947
12948

I was able to send a test email to an email ID, but I do not know how to test it without internet since it is a VM on techvcenter. I will detach the NIC tonight for the VM and test it when it tries to send at 3:00AM.

#23 Updated by Rishabh Chauhan 11 months ago

13006

After searching for Tracebacks in /var/log/debug.log , I found two traceback errors which was not related to email as shown in the attached image, which was not related to routine email. Test Pass

Also available in: Atom PDF