-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
ResourceWarnings with PYTHONDEVMOVE=1 #1621
Comments
So the issue here isn't Could you try setting the environment variable
The |
A-ha! I made a clean poetry-based virtualenv with only trio (and its dependencies) and Python 3.8.3. Test 1) Test 2): Test 3): So, either PYTHONDEVMODE is right, and something isn't being closed behind the scenes, or enabling PYTHONDEVMODE somehow causes different - and broken - behavior?
Color me surprised that |
So Because There probably is some minor bug in some piece of code you're using that's causing those sockets to be left unclosed, but it's hard to know what. Could be Trio, could be in poetry, I dunno. Try:
Yes, that's when they close. Notice that the only thing inside the context manager's |
Poetry shouldn't be relevant, it's basically a newer, better virtualenvwrapper. However, I can remove it from the equation and activate the virtualenv directly:
The output appears to be identical with or without tracemalloc enabled. The only library (directly) invoked is trio - does trio itself open (and fail to close when handling KI) a socketpair somewhere deep in its bowels? |
Huh, that's frustrating.
Trio does use some socketpairs. I think it closes them properly... it seems to here, anyway. But I could be wrong! That's what we're trying to figure out :-). What version of Python are you using? What version of Trio? What OS are you using? |
Python: 3.8.3 Here's a clue: I've tried reproducing in a Docker image ( As an additional test on my Mac:
|
I'm seeing the same |
This small bug was introduced in python-triogh-1551 Fixes python-triogh-1621
This small bug was introduced in python-triogh-1551 Fixes python-triogh-1621
Ah-ha. If it's macOS specific, that makes it easy to track down :-). Fixed in #1623. Thanks for the report! I am still super confused about why tracemalloc doesn't seem to work on your system. On my system, when I get a |
https://github.com/python-trio/trio/blob/master/docs/source/tutorial.rst#when-things-go-wrong-timeouts-cancellation-and-exceptions-in-concurrent-tasks
What's the Right Way to catch KeyboardInterrupt? Here's trio's channel example:
Here's what happens when a ctrl-c occurs:
I've tried various
try/except
changes, none of which seem to properly close the socket.Also, why does not cloning (
.clone()
) both channels cause an immediateraise trio.ClosedResourceError
?The text was updated successfully, but these errors were encountered: