1
1
openmpi/ompi/mca
Jeff Squyres 95d7e08a66 More more discussion and testing has occurred off-ticket.
Short version: there is a bug in OS X/Snow Leopard, but there is also
a bug in Open MPI.  Fixing the bug in Open MPI is both trivial (a
1-line change) and avoids the bug in OS X.  We'll file an OS X bug
report upstream with Apple, but it should no longer affect us here in
OMPI.

Fixes trac:2039.

More details:

Some background first: 

 1. IPv4 sockets can only accept incoming IPv4 connections.  However,
    IPv6 sockets can be configured to accept ''only'' incoming IPv6
    connection, or ''both'' incoming IPv4 and IPv6 connections.  An
    IPv6 socket attribute sets which listening behavior is used.
 1. IPv4 and IPv6 have different port namespaces.  Hence, it is
    permissable to bind a v4 socket to port X ''and'' also bind a v6
    socket to that same port X on the same interface (assuming that
    the v6 socket is only accepting incoming v6 connections).
    Incoming v4 connections to port X on the interface should get
    matched to the listening v4 socket; incoming v6 connections should
    get matched to the listening v6 socket.
 1. When v6 sockets accept ''both'' incoming v4 and v6 connections, it
    should claim port X in both namespaces.
 1. Linux's default behavior is to only allow one listening socket to
    be bound to a given port (i.e., ''either'' a v6 or v4 socket to be
    bound to a single port X -- not both).  A v6 socket can listen for
    both v4 and v6 incoming connections on that port, but still --
    only one socket will be bound to that port.
 1. Snow Leopard's default behavior is to share ports -- i.e., let
    both a v4 and a v6 listening socket to be bound to port X
    (assuming that the v6 socket is only accepting incoming v6
    connections).

The TCP BTL creates a listening socket for each address family.
Hence, it creates a v4 listening socket on INADDR_ANY and a v6
listening socket on the v6 equivalent of INADDR_ANY.  OMPI then
iteratively tries to find ports to listen on within the range of
[mca_btl_tcp_port_min, mca_btl_tcp_port_min + mca_btl_tcp_port_range).

On Linux, the v4 socket will be bound to port X and the v6 socket will
likely be bound to port Y (where X != Y).  On Snow Leopard, the v4
socket will be bound to port X and the v6 socket may ''also'' be bound
to port X.  Since the namespaces are separate, this shouldn't be a
problem.

However, Open MPI was accidentally setting the v6 listening behavior
to accept ''both'' v4 and v6 incoming connections.  This is a trivial
thing to fix -- change a 0 to a 1 in the code.  On Linux, this issue
didn't matter because the v4 and v6 sockets were on different ports.
So even though the v6 socket ''would'' have accepted incoming v4
connections, that never happened because OMPI would direct v4
connections to the v4 port.

But on Snow Leopard, the v4 and v6 listening ports could end up
sharing the same port number.  As mentioned above, this ''shouldn't''
have been a problem, but it looks like Snow Leopard has the following
bugs:

 * If a v4 socket is already bound to port X, we're pretty sure that a
   v6 socket with the "accept both v4 and v6 incoming connections"
   listening behavior should not be able to claim port X (because
   there's already a v4 socket listening on X).  However, Snow Leopard
   would allow binding a v4 socket to port X, and then allow a v6
   socket configured to allow incoming v4 and v6 connections to
   ''also'' be bound to port X.
 * After binding the v6 socket to port X, Snow Leopard then lets
   ''another'' v4 socket ''also'' get bound to port X.  Hence, there's
   now '''three''' sockets all listening on port X.

This obviously led to mis-matched TCP connections, and things went
downhill from there.

That being said, Snow Leopard doesn't exhibit this behavior if v6
sockets only allow incoming v6 connections.  And technically, that is
exactly the behavior we want (we want v6 sockets to only accept
incoming v6 connections).  So if we just change the flag to make our
v6 listening socket us this behavior, the problem on OS X goes away.

That's what this commit does -- it changes a 0 to a 1, indicating
"only let this v6 socket allow incoming v6 connections."

That was simple, wasn't it?

This commit was SVN r22788.

The following Trac tickets were found above:
  Ticket 2039 --> https://svn.open-mpi.org/trac/ompi/ticket/2039
2010-03-05 17:37:57 +00:00
..
allocator Fix the bug that caused by ADD_DEPENDENCIES() from different version of CMake. 2010-01-14 18:10:20 +00:00
bml Restore several linked libraries that were deleted by mistake in r22405. 2010-01-14 21:50:42 +00:00
btl More more discussion and testing has occurred off-ticket. 2010-03-05 17:37:57 +00:00
coll Amendment to r22671: change the name of the new communicator flag from 2010-02-23 21:24:07 +00:00
common Fix spelling of "degradation". 2010-02-25 19:41:59 +00:00
crcp - Replace combinations of 2009-08-20 11:42:18 +00:00
dpm Fix --bynode option to remember for subsequent jobs where it left off last time. 2010-02-05 15:37:49 +00:00
io AC_CHECK_FUNCS. Removes an annoying warning during application link on 2010-02-04 04:42:36 +00:00
mpool The release of memory used by registration lists in rcaches must be delayed until the rcache lock is not held or deadlock 2010-02-23 11:31:58 +00:00
mtl Allow the PSM component to return ERR_NOT_AVAIL so it can be unloaded silently if executed on a node with no QLogic IB hardware. Also minor modifications to have the CM PML allow itself to be unloaded if no MTL components are available. The component selection logic can then continue to use other PMLs. 2010-01-14 19:39:35 +00:00
op Update Cisco copyrights for consistency 2009-10-07 22:02:32 +00:00
osc Fixes case where there is unprotected access to 2010-02-24 01:28:37 +00:00
pml This fixes trac:2154 - CSUM PML false positive. Needs to go to both cmr:v1.4.2 and cmr:v1.5 2010-02-10 10:24:16 +00:00
pubsub Restore several linked libraries that were deleted by mistake in r22405. 2010-01-14 21:50:42 +00:00
rcache Get the function prototypes to match so we eliminate an annoying warning 2010-02-27 16:41:16 +00:00
topo - Replace combinations of 2009-08-20 11:42:18 +00:00