python fails asyncio tests (py 3.7 & 3.8)

Marco Atzeri
Mon Feb 1 10:17:00 GMT 2021

On 03.12.2020 10:28, Corinna Vinschen via Cygwin-developers wrote:
> On Dec  2 22:57, Mark Geisert wrote:
>> [replying to myself.. sorry..]
>> On Wed, 2 Dec 2020, Mark Geisert wrote:
>>> Hi Corinna,
>>> On Wed, 2 Dec 2020, Corinna Vinschen wrote:
>>> [...]
>>>> This is apparently an old problem in the still current AF_LOCAL
>>>> implementation.  Christian Franke encountered it when porting postfix:
>>>> The problem is the security handshake between listening/accepting socket
>>>> and connecting socket.  The connecting socket send its half of the
>>>> handshake and waits for accept on the other side to return the other
>>>> half.  However, if the listening side doesn't accept right away, the
>>>> connecting side hangs.
>>>> The workaround right now is to call
>>>>   int peercred_off = 1;
>>>>   fd = socket (AF_LOCAL, SOCK_STREAM, 0);
>>>>   setsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred_off, sizeof
>>>> peercred_off);
>>>> This disables the security handshake.
>>> I see.  For this problem report should the setsockopt() workaround be
>>> applied to Python (yikes!) or can it be done for all apps at once in
>>> fhandler_socket_local::socket()?  I might be able to look into the
>>> standing issue with the security handshake later on, if (my) time
>>> permits. I appreciate the history/explanation on this.
>>> Thanks & Regards,
>>> ..mark
>> Putting the workaround in fhandler_socket_local::socket() compiles fine and
>> the OP's Python testing issue seems fixed.  OTOH XWin and X apps exit soon
>> after starting so that's no bueno.
>> It looks like the individual Python tests that exhibit the problem are going
>> to need patching.  Does that sound about right?
> In theory it's just a testcase and we have a known workaround for
> that.  The testcase can be marked as XFAIL for Cygwin or get the
> extra setsockopt() call for Cygwin, both is fine.
> Corinna

the latest python packages to solve the asyncio issue are patched
to bypass  Cygwin "socketpair" and use an internal alternative
Python3 version for system without that functionality.

But of course proper working socket functions will be appreciated.

      a, b = _socket.socketpair(family, type, proto)
SystemError: <built-in function socketpair> returned NULL without 
setting an error


More information about the Cygwin-developers mailing list