Skip to content

Conversation

@tiran
Copy link
Member

@tiran tiran commented Oct 30, 2023

On PyPy 3.9 sock.close() sometimes fails with Bad file descriptor, because the fd is already closed. Silence the exception. The problem is not a bug in python-ldap.

Really use PyPy 3.9 in tox.ini.

On PyPy 3.9 `sock.close()` sometimes fails with `Bad file descriptor`,
because the fd is already closed. Silence the exception. The problem is
not a bug in python-ldap.

Really use PyPy 3.9 in `tox.ini`.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
@mistotebe
Copy link
Contributor

-1 on this: we should really figure out why the socket was closed already to an authoritative reason.

Being opportunistic and then masking the error risks hiding hard to diagnose high severity bugs which we've had a hard time with using heimdal etc. in the past (a library closes its file descriptor, the fd # is reused by independent code and the library closes that one too).

@tiran
Copy link
Member Author

tiran commented Oct 30, 2023

Be my guest and good luck figuring it out... The problem only occurs with PyPy 3.9 on GitHub Actions and only every few test runs. It's rather random. I have not been able to reproduce the issue locally either.

In the mean time, I can work around the issue by restarting the failed test manually.

@mistotebe
Copy link
Contributor

Ok, I've had a try and can reproduce this quite reliably (even with --jit off, I think). Indeed close() is called several times on the same fd in Test03_SimpleLDAPObjectWithFileno, however trying to debug this in gdb, I cannot see who is calling the close() in each instance. Unlike with CPython I can't seem to be able to extract the python stack at the time of that call. Have you had any success/do you have hints on how that could be achieved?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants