New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_ftplib timeouts #62992
Comments
Some ftplib tests sometimes time out. Seem they seem to try to connect to "localhost" (rather than "127.0.0.1"), I was wondering if this could be a DNS issue and if we should resolve "localhost" in advance like Charles-François did for some other tests (or simply hardcode "127.0.0.1", actually). http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/7060/steps/test/logs/stdio (example: ====================================================================== Traceback (most recent call last):
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_ftplib.py", line 953, in testTimeoutDefault
ftp = ftplib.FTP("localhost")
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\ftplib.py", line 115, in __init__
self.connect(host)
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\ftplib.py", line 150, in connect
source_address=self.source_address)
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\socket.py", line 454, in create_connection
raise err
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\socket.py", line 445, in create_connection
sock.connect(sa)
socket.timeout: timed out ) |
If it only happens on Windows >= 7 buildbots, then it's likely a Apparently, since Windows 7, "localhost" doesn't appear in the hosts Hard-cording 127.0.0.1 for this test should be OK, because the server |
Ok, let's do it! |
Here is a patch for default. |
Changing support.HOST from 'localhost' to '127.0.0.1' means that on dual-stack >>> socket.getaddrinfo('localhost', 0)
[(10, 1, 6, '', ('::1', 0, 0, 0)), (10, 2, 17, '', ('::1', 0, 0, 0)),
(10, 3, 0, '', ('::1', 0, 0, 0)), (2, 1, 6, '', ('127.0.0.1', 0)), (2,
2, 17, '', ('127.0.0.1', 0)), (2, 3, 0, '', ('127.0.0.1', 0))] So on this host, 'localhost' resolves to '::1'. I think it would be |
That would only be true if the server we are contacting happens to |
Ah, I thought some code was using getaddrinfo() to select an arbitrary That's OK then. |
LGTM |
New changeset 085ba7d85eb2 by Antoine Pitrou in branch 'default': |
New changeset 7728b073c77c by Antoine Pitrou in branch '3.3': |
New changeset 48de8df194d9 by Antoine Pitrou in branch '2.7': |
Done, thanks :) |
FYI - hardcoding these addresses is now causing me problems as I try to get our test suite passing on IPv6 only hosts. "localhost" is correct. IMNSHO if for some reason a system cannot resolve "localhost" into a correct address, it should be banned from running any form of networking related test. :/ I should not have to write messy conditional code to try and determine which type of socket I will likely need to bind to to determine which format of IP address string I need to supply as the localhost bind address. That is backwards! |
https://bugs.python.org/issue29639 opened to track undoing this when appropriate. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: