Skip to content
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

Thread safety when usage with Pytest, and Coverage cause unexpected hang at exit #4052

Open
teruokun opened this issue Jul 18, 2024 · 0 comments

Comments

@teruokun
Copy link

Appears to be introduced in 6.103.4 and existing until the current version (6.108.2) but appears to happen specifically in our network-isolated environments (like a network-jailed build container). When doing deep level logging of the python interpreter, it appears specifically to be blocked during the destruction/cleanup phase, meaning there's either a stray thread or reference not being cleaned up properly when Coverage runs with the pytest hypothesis plugin. My current theory is that the new thread_local() internal cache has mutable structures shared out as references to the thread-local objects themselves because of their mutability instead of handling that thread-local nature entirely within the cache logic. The sharing of that reference means it no longer necessarily abides by thread-safety if a new thread is forked because the stored reference still points at the object (though admittedly thread_local itself has strange enough semantics that perhaps I misunderstand it as well).

I'm attempting to build an actual reproduction of the issue that is easily verifiable, but it may take time to get all of it set up properly and want to get the issue known about in case any others find a similar issue.

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

No branches or pull requests

1 participant