classification
Title: test.test_logging.SMTPHandlerTest failing on Snow Leopard
Type: behavior Stage: resolved
Components: macOS, Tests Versions: Python 3.5, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: geoffreyspear, ned.deily, python-dev, ronaldoussoren, vinay.sajip
Priority: normal Keywords: patch

Created on 2015-01-09 19:43 by geoffreyspear, last changed 2015-01-18 01:36 by ned.deily. This issue is now closed.

Files
File name Uploaded Description Edit
issue23211.patch ned.deily, 2015-01-15 22:04 review
Messages (7)
msg233779 - (view) Author: Geoffrey Spear (geoffreyspear) * Date: 2015-01-09 19:43
This seems to be related to issue20605 where _socket.getaddrinfo() mysteriously fails on some Snow Leopard systems but not others; I don't think the cause of that one was ever explained but this appears to be the same error:


======================================================================
ERROR: test_basic (test.test_logging.SMTPHandlerTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/geoff/Documents/programming/cpython/Lib/test/test_logging.py", line 930, in test_basic
    sockmap)
  File "/Users/geoff/Documents/programming/cpython/Lib/test/test_logging.py", line 687, in __init__
    decode_data=True)
  File "/Users/geoff/Documents/programming/cpython/Lib/smtpd.py", line 654, in __init__
    type=socket.SOCK_STREAM)
  File "/Users/geoff/Documents/programming/cpython/Lib/socket.py", line 730, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
msg234097 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-01-15 22:04
Yes, this has the same root cause as the failure in Issue20605 since SMTPServer in smtpd.py uses getaddrinfo.  I'm now able to reliably reproduce the failure.  The system getaddrinfo failure is seen when the OS X 10.6 system's network configuration is *not* using the local mdns for its primary domain service (which can be checked with "scutil --dns"); it fails when using an external dns as its primary dns service.  At least that's one failure scenario.  In any case, this seems to have been fixed in later versions of OS X, the problem appears to be unique to getaddrinfo (gethostbyname works OK), and it's only this one test.  I'm tempted to just close this as "won't fix"; on the other hand, it's easy enough to change this test to use '127.0.0.0' instead of 'localhost'; there are precedents for doing that for other reasons (Issue18792, for example).  Here's a patch that does so and thus avoids the potential problem on 10.6.  I'll apply it if there are no objections.
msg234130 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2015-01-16 13:46
No objections from me.
msg234208 - (view) Author: Roundup Robot (python-dev) Date: 2015-01-18 01:00
New changeset 90b664532d1c by Ned Deily in branch '3.4':
Issue #23211: Workaround test_logging failure on some OS X 10.6 systems:
https://hg.python.org/cpython/rev/90b664532d1c

New changeset e3dfe942697e by Ned Deily in branch 'default':
Issue #23211: merge from 3.4
https://hg.python.org/cpython/rev/e3dfe942697e
msg234209 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-01-18 01:02
OK, the workaround is applied for 3.4.3 and 3.5.0.
msg234212 - (view) Author: Roundup Robot (python-dev) Date: 2015-01-18 01:34
New changeset 65ac2b992673 by Ned Deily in branch '3.4':
Issue #23211: Fix patch for 3.4 differences.
https://hg.python.org/cpython/rev/65ac2b992673

New changeset 2d71d0f954fb by Ned Deily in branch 'default':
Issue #23211: null merge
https://hg.python.org/cpython/rev/2d71d0f954fb
msg234213 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-01-18 01:36
I *thought* I had tested 3.4 before; sorry about that!
History
Date User Action Args
2015-01-18 01:36:29ned.deilysetmessages: + msg234213
2015-01-18 01:34:19python-devsetmessages: + msg234212
2015-01-18 01:02:20ned.deilysetstatus: open -> closed
resolution: fixed
messages: + msg234209

stage: patch review -> resolved
2015-01-18 01:00:28python-devsetnosy: + python-dev
messages: + msg234208
2015-01-16 13:46:02vinay.sajipsetmessages: + msg234130
2015-01-15 22:04:28ned.deilysetfiles: + issue23211.patch

versions: + Python 3.4
keywords: + patch
nosy: + vinay.sajip

messages: + msg234097
stage: patch review
2015-01-09 19:43:52geoffreyspearcreate