• Ingo Struewing's avatar
    Bug#37267 - connect() EINPROGRESS failures mishandled in client library · 1e87babb
    Ingo Struewing authored
    We cann connect() in a non-blocking mode to be able to specify a
    non-standard timeout.
    
    The problem was that we did not fetch the status from the
    non-blocking connect(). We assumed that poll() would not return
    a POLLIN flag if the connect failed. But on some platforms this
    is not true.
    
    After a successful poll() we do now retrieve the status value
    from connect() with getsockopt(...SO_ERROR...). Now we do know
    if (and how) the connect failed.
    
    The test case for my investigation was rpl.rlp_ssl1 on an
    Ubuntu 9.04 x86_64 machine. Both, IPV4 and IPV6 were active.
    'localhost' resolved first for IPV6 and then for IPV4. The
    connection over IPV6 was blocked. rpl.rlp_ssl1 timed out
    as it did not notice the failed connect(). The first read()
    failed, which was interpreted as a master crash and the
    connection was tried to reestablish with the same result
    until the retry limit was reached.
    
    With the fix, the connect() problem is immediately recognized,
    and the connect() is retried on the second resolution for
    'localhost', which is successful.
    1e87babb
wait_for_slave_param.inc 3.03 KB