This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.snow
Recipients eric.snow
Date 2019-03-29.20:39:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1553891967.48.0.271328539114.issue36477@roundup.psfhosted.org>
In-reply-to
Content
When using subinterpreters, any that exist when Py_FinalizeEx() is called do not appear to get cleaned up during runtime finalization.  Maybe I've been looking at the code too much and I'm missing something. :)

This really isn't a problem except for embedders that use subinterpreters (where we're leaking memory).  However, even with the "python" executable it can have an impact because the subinterpreters' non-daemon threads will exit later than expected. (see #36469 & #36476)

The solution would be to finalize all subinterpreters at the beginning of Py_FinalizeEx(), right before the call to wait_for_thread_shutdown().  This means calling Py_EndInterpreter() for all the runtime's interpreters (except the main one).  It would also mean setting a flag (_PyRuntime.interpreters.finalizing?) right before that to disallow creation of any more subinterptreters.
History
Date User Action Args
2019-03-29 20:39:27eric.snowsetrecipients: + eric.snow
2019-03-29 20:39:27eric.snowsetmessageid: <1553891967.48.0.271328539114.issue36477@roundup.psfhosted.org>
2019-03-29 20:39:27eric.snowlinkissue36477 messages
2019-03-29 20:39:27eric.snowcreate