[New-bugs-announce] [issue36477] Subinterpreters are not finalized during runtime finalization.

Eric Snow report at bugs.python.org
Fri Mar 29 16:39:27 EDT 2019


New submission from Eric Snow <ericsnowcurrently at gmail.com>:

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.

----------
components: Interpreter Core
messages: 339144
nosy: eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: Subinterpreters are not finalized during runtime finalization.
type: behavior
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36477>
_______________________________________


More information about the New-bugs-announce mailing list