cpython icon indicating copy to clipboard operation
cpython copied to clipboard

IsolatedAsyncioTestCase `__del__` could be dangerous

Open graingert opened this issue 3 years ago • 2 comments

It looks like in IsolatedAsyncioTestCase when debug() crashes it doesn't teardown the event loop, in addition it seems that if the loop isn't torn down it will happen in __del__ which means thread local sensitive functions like set_event_loop get called via the GC from potentially the wrong thread

Originally posted by @graingert in https://github.com/python/cpython/pull/95898#discussion_r946516908

graingert avatar Aug 16 '22 09:08 graingert

Apart from a reproducer it would be nice if your issue description was more clearly stating the problem. Quoting from the middle of another discussion is just confusing.

gvanrossum avatar Aug 16 '22 21:08 gvanrossum

I had a go at undrafting the issue, I still need to make a reproducer

graingert avatar Aug 16 '22 21:08 graingert

Hm... I had sort of assumed that debug() was intentionally not cleaning anything up on failure -- TestCase.debug() doesn't either (it has a special case for @skip though).

PS. There is no such thing as a draft issue.

gvanrossum avatar Aug 16 '22 22:08 gvanrossum

What's the status of this? @graingert Do you have a reproducer?

kumaraditya303 avatar Dec 13 '22 14:12 kumaraditya303

Nothing changed. #96135 solved some potential problems in our tests of unittest by using a private method, but the original problem still exists.

It is not even clear what solution should be.

serhiy-storchaka avatar Dec 13 '22 18:12 serhiy-storchaka