Bug #24949
Don't traceback when unable to send email
HP Microserver G7
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):
Associated revisions
History
#1
Updated by Sean Fagan over 3 years ago
- Status changed from Unscreened to Screened
Not sure why this went to me.
#2
Updated by Dru Lavigne over 3 years 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 3 years ago
- Status changed from Unscreened to 15
#4
Updated by Alec Pearson over 3 years ago
I have updated to 11.0-U1 now, but I think it was 11.0-RELEASE (a2dc21583)
#5
Updated by Dru Lavigne over 3 years ago
To clarify: you still get the traceback on U1?
#6
Updated by Alec Pearson over 3 years 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 3 years 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 3 years ago
- Status changed from 15 to Unscreened
- Assignee changed from Release Council to William Grzybowski
#9
Updated by William Grzybowski over 3 years 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 3 years 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 3 years 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 3 years 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 3 years 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 3 years 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 3 years 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 over 3 years ago
- Assignee changed from Sean Fagan to William Grzybowski
#17
Updated by William Grzybowski over 3 years ago
- Status changed from Needs Developer Review to Reviewed by Developer
#18
Updated by Dru Lavigne over 3 years 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 over 3 years ago
- Assignee changed from William Grzybowski to Sean Fagan
#20
Updated by Dru Lavigne over 3 years 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 about 3 years ago
- Status changed from Ready For Release to Resolved
#22
Updated by Rishabh Chauhan about 3 years ago
- File emailreceived.png emailreceived.png added
- File emailsent.png emailsent.png added
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 about 3 years ago
- File tracebacksnotrelatedtoemail.png tracebacksnotrelatedtoemail.png added
- Needs QA changed from Yes to No
- QA Status Test Passes FreeNAS added
- QA Status deleted (
Not Tested)
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