Skip to content

bpo-31882: Cygwin: fix/skip some tests to work around hang in asyncio/asyncore test suites #4149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

embray
Copy link
Contributor

@embray embray commented Oct 27, 2017

From the issue:

Some of the tests for asyncio and asyncore block forever on Cygwin, due to a known (and seemingly difficult to fix) bug in Cygwin involving SO_PEERCRED on UNIX sockets.

SO_PEERCRED is a socket option that can be used to exchange file ownership info of the socket at the time the connection was established (specifically on UNIX sockets). This feature is technically supported on Cygwin, but the effect of the bug is that if two sockets are opened on the same process (even without using socketpair()), the credential exchange protocol can cause connect() on the "client" socket to block unless the "server" socket is already listen()-ing.

This situation is not all that common in practice (it is not a problem if the "client" and "server" are separate processes). But it does show up in the test suite in a number of places, since both sockets belong to the same process.

This PR fixes the issue in some cases by explicitly NULL-ifying the SO_PEERCRED struct on the socket. This is preferable because with this small workaround those tests pass. Unfortunately, in other cases it was difficult to do this just for the test suite without too much meddling, so I just marked those tests to be skipped.

https://bugs.python.org/issue31882

* connect()-ing an AF_UNIX socket can hang indefinitely
  if the server is not actively accept()-ing connections; see
  https://cygwin.com/ml/cygwin/2017-01/msg00054.html This issue is
  worked around explicitly in the tests, but not generally in asyncore
  (as the only known general workaround breaks SO_PEERCRED queries).
  It's also something of a corner-case which won't affect non-test code
  often.
Unfortunately it's harder to work around in these tests since socket creation
is significantly more buried in the code being tested.  Better to just skip
them.
@iritkatriel
Copy link
Member

iritkatriel commented Oct 20, 2021

The bpo was closed under bpo-45537 (Cygwin is unsupported).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants