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.

classification
Title: atexit leaks callbacks in subinterpreters
Type: resource usage Stage: resolved
Components: Interpreter Core, Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Robin.Schreiber, pitrou, python-dev, sbt
Priority: normal Keywords: patch

Created on 2013-08-01 18:20 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
atexit_leaks.patch pitrou, 2013-08-01 18:47 review
Messages (4)
msg194098 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-08-01 18:20
atexit uses PEP 3121 module initialization, and by this scheme each subinterpreter gets a separate module state. However, atexit's m_free doesn't actually decref the callbacks: it only frees the callbacks array, thinking the callbacks were already decref'ed when run. This is ok at main interpreter shutdown, but not at subinterpreter shutdown (see issue 18618).
msg194100 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-08-01 18:47
Here is a patch. It also enables GC on the atexit module.
msg194101 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-01 18:56
New changeset 71b63a32b1e3 by Antoine Pitrou in branch 'default':
Issue #18619: Fix atexit leaking callbacks registered from sub-interpreters, and make it GC-aware.
http://hg.python.org/cpython/rev/71b63a32b1e3
msg194102 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-08-01 18:57
The patch was simple enough that I decided to push it as-is :)
Don't hesitate to make comments if you want, though.
History
Date User Action Args
2022-04-11 14:57:48adminsetgithub: 62819
2013-08-01 18:57:05pitrousetstatus: open -> closed
resolution: fixed
messages: + msg194102

stage: needs patch -> resolved
2013-08-01 18:56:20python-devsetnosy: + python-dev
messages: + msg194101
2013-08-01 18:47:23pitrousetfiles: + atexit_leaks.patch
keywords: + patch
messages: + msg194100
2013-08-01 18:20:15pitroucreate