python fails asyncio tests (py 3.7 & 3.8)

Mark Geisert
Mon Dec 7 07:58:27 GMT 2020

[Replying to myself...]

Mark Geisert wrote:
> Jim Bell wrote:
>> On 2020-11-21 5:59 AM, Jim Bell wrote:
>>> The standard python asyncio tests hang.
>>>         cd /usr/lib/python3.8/test
>>>         python3.8 -v
>>> [...]
>> Using strace, stripping down this very repeatable test, and grabbing the 
>> source-code snapshot, it looks like winsup/cygwin/ socket_cleanup() is 
>> waiting forever for the thread to go away.
>> strace:
>>    121 6732185 [main] python3.8 13329 select_stuff::cleanup: calling cleanup rout
>> ines
>>    178 6732363 [main] python3.8 13329 socket_cleanup: si 0x800290E10 si->thread 0
>> x18023E758
>> -
> Thanks for the report and especially for the initial debugging you've done.  I've 
> reproduced the issue on my test machine.  No need to supply 'cygcheck -svr' at 
> this point.  I'll investigate this further and keep you posted (on the Cygwin 
> mailing list).

The problem is actually further down in the guts of Cygwin's Unix Domain Socket 
handling.  Specifically it has to do with the credential passing between client 
and server ends of a connection as part of its setup.  There is a workaround for 
this problem that involves turning off socket option SO_PEERCRED on both the 
connecting and listening sockets.

Unfortunately there's another problem.  With the current Cygwin DLL build you'll 
get an EINVAL error trying to do that setsockopt() operation.  I have submitted a 
patch that fixes this 2nd problem.  A future Cygwin snapshot TBA will contain this 

As for the test script errors you reported, I can submit a workaround patch that 
would make its way into the Python3.8 tests.  I am unsure at the moment which 
Cygwin package contains those tests but I can figure that out.  Otherwise, I could 
tell you what needs to be patched in and you could edit the 
script yourself to fix this locally for yourself.

Let me know how you'd like to proceed, when you have a chance.


More information about the Cygwin mailing list