[issue3270] test_multiprocessing: test_listener_client flakiness
Jesse Noller
report at bugs.python.org
Thu Jul 3 14:58:44 CEST 2008
New submission from Jesse Noller <jnoller at gmail.com>:
Per mail thread:
http://mail.python.org/pipermail/python-dev/2008-June/080497.html
Attached is the patch to connection.py to drop the fqdn call.
Final suggestion from Trent:
> This is a common problem. Binding to '127.0.0.1' will bind to *only*
> that address;
Indeed.
> binding to "" will bind to *all* addresses the machine
> is known by.
Agreed again. I believe what we're dealing with here though is a lack
of clarity regarding what role the 'address' attribute exposed by
multiprocess.connection.Listener should play. The way
test_listener_client() is written, it effectively treats 'address' as an
end-point that can be connected to directly (irrespective of the
underlying family (i.e. AF_INET, AF_UNIX, AF_PIPE)).
I believe the problems we've run into stem from the fact that the API
doesn't provide any guarantees as to what 'address' represents. The
test suite assumes it always reflects a connectable end-point, which I
think is more than reasonable. Unfortunately, nothing stops us from
breaking this invariant by constructing the object as
Listener(family='AF_INET', address=('0.0.0.0', 0)).
How do I connect to an AF_INET Listener (i.e. SocketListener) instance
whose 'address' attribute reports '0.0.0.0' as the host? I can't.
So, for now, I think we should enforce this invariant by raising an
exception in Listener.__init__() if self._socket.getsockbyname()[0]
returns '0.0.0.0'. In effect, tightening up the API such that we can
guarantee Listener.address will always represent a connectable end-
point. We can look at how to service 'listen on all available
interfaces' semantics at a later date -- that adds far less value IMO
than being able to depend on the said guarantee.
----------
assignee: jnoller
components: Library (Lib)
files: connection.patch
keywords: patch
messages: 69197
nosy: jnoller, roudkerk
priority: high
severity: normal
status: open
title: test_multiprocessing: test_listener_client flakiness
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file10801/connection.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3270>
_______________________________________
More information about the Python-bugs-list
mailing list