-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Crash in asyncio when printing a task object at teardown #96232
Copy link
Copy link
Closed as not planned
Labels
3.10only security fixesonly security fixes3.11only security fixesonly security fixes3.12only security fixesonly security fixespendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtopic-asynciotype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Metadata
Metadata
Assignees
Labels
3.10only security fixesonly security fixes3.11only security fixesonly security fixes3.12only security fixesonly security fixespendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtopic-asynciotype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Projects
Status
Done
If a task object is still alive at interpreter teardown, something can try to print it. This will end in
_asyncio.Future._repr_infothat in turn calls:but
asyncio_future_repr_info_funcat that point can beNULLbecausemodule_freeof_asynciomodule.chas been executed already, called byPy_FinalizeEx -> finalize_modules -> _PyInterpreterState_ClearModules -> ... -> module_dealloc.The crash happens in the last
_PyGC_CollectNoFailoffinalize_modulesso somehow the task survived the first collection and then was garbage in the second one.I don;t have a simple repro for now, but you can get the failure by cloning https://github.com/Textualize/textual checking commit 5fe47da058564b72e5081a5658c054f55a5d85cd, installing the project and test deps and running
pytest.