You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code that calls into the List and Dict proxies finalize has this context:
#3 PyListProxyHandler::finalize (this=, gcx=, proxy=)
at /home/philippe/Sources/PythonMonkey/src/PyListProxyHandler.cc:2108 #4 0x00007ffff501a47d in proxy_Finalize(JS::GCContext*, JSObject*) () from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #5 0x00007ffff51ffcf3 in unsigned long js::gc::Arena::finalize(JS::GCContext*, js::gc::AllocKind, unsigned long) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #6 0x00007ffff51f0223 in FinalizeArenas(JS::GCContext*, js::gc::ArenaList&, js::gc::SortedArenaList&, js::gc::AllocKind, js::SliceBudget&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #7 0x00007ffff51f1f54 in js::gc::GCRuntime::sweepBackgroundThings(js::gc::ZoneList&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #8 0x00007ffff51f2319 in js::gc::GCRuntime::sweepFromBackgroundThread(js::AutoLockHelperThreadState&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #9 0x00007ffff51c9e73 in js::GCParallelTask::runTask(JS::GCContext*, js::AutoLockHelperThreadState&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #10 0x00007ffff51c9ad4 in js::GCParallelTask::runFromMainThread() () from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #11 0x00007ffff51f7f6a in js::gc::GCRuntime::endSweepingSweepGroup(JS::GCContext*, js::SliceBudget&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #12 0x00007ffff5204aec in sweepaction::SweepActionSequence::run(js::gc::SweepAction::Args&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #13 0x00007ffff5202ae9 in sweepaction::SweepActionForEach<js::gc::SweepGroupsIter, JSRuntime*>::run(js::gc::SweepAction::Args&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #14 0x00007ffff51f9ee0 in js::gc::GCRuntime::performSweepActions(js::SliceBudget&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #15 0x00007ffff51bdbbe in js::gc::GCRuntime::incrementalSlice(js::SliceBudget&, JS::GCReason, bool) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
--Type for more, q to quit, c to continue without paging-- #16 0x00007ffff51beefe in js::gc::GCRuntime::gcCycle(bool, js::SliceBudget const&, JS::GCReason) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #17 0x00007ffff51bf50e in js::gc::GCRuntime::collect(bool, js::SliceBudget const&, JS::GCReason) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #18 0x00007ffff51a9322 in js::gc::GCRuntime::gc(JS::GCOptions, JS::GCReason) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #19 0x00007ffff4eec874 in JSRuntime::destroyRuntime() () from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #20 0x00007ffff4e456a1 in js::DestroyContext(JSContext*) () from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so #21 0x00007ffff6c6ec10 in cleanup () at /home/philippe/Sources/PythonMonkey/src/modules/pythonmonkey/pythonmonkey.cc:217 #22 0x00005555556b489d in call_ll_exitfuncs (runtime=) at Python/pylifecycle.c:2423 #23 Py_FinalizeEx () at Python/pylifecycle.c:1506 #24 0x00005555556b6ab6 in Py_FinalizeEx () at Python/pylifecycle.c:1350 #25 Py_Exit (sts=0) at Python/pylifecycle.c:2433
GC only happens when Spidermonkey thinks it's running out of mem, not too eagerly
What I'm really after is the code to detect we are finalizing at exit and cannot then call dec ref without crashing and cannot even call functions to tell us if we would crash if we called decref
The text was updated successfully, but these errors were encountered:
philippedistributive
changed the title
Proxy finalize only called at python exit
Memory leak: Proxies backing PyObject reference does not get decremented in finalize
Jan 26, 2024
Bug Description
The code that calls into the List and Dict proxies finalize has this context:
#3 PyListProxyHandler::finalize (this=, gcx=, proxy=)
at /home/philippe/Sources/PythonMonkey/src/PyListProxyHandler.cc:2108
#4 0x00007ffff501a47d in proxy_Finalize(JS::GCContext*, JSObject*) () from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#5 0x00007ffff51ffcf3 in unsigned long js::gc::Arena::finalize(JS::GCContext*, js::gc::AllocKind, unsigned long) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#6 0x00007ffff51f0223 in FinalizeArenas(JS::GCContext*, js::gc::ArenaList&, js::gc::SortedArenaList&, js::gc::AllocKind, js::SliceBudget&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#7 0x00007ffff51f1f54 in js::gc::GCRuntime::sweepBackgroundThings(js::gc::ZoneList&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#8 0x00007ffff51f2319 in js::gc::GCRuntime::sweepFromBackgroundThread(js::AutoLockHelperThreadState&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#9 0x00007ffff51c9e73 in js::GCParallelTask::runTask(JS::GCContext*, js::AutoLockHelperThreadState&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#10 0x00007ffff51c9ad4 in js::GCParallelTask::runFromMainThread() () from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#11 0x00007ffff51f7f6a in js::gc::GCRuntime::endSweepingSweepGroup(JS::GCContext*, js::SliceBudget&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#12 0x00007ffff5204aec in sweepaction::SweepActionSequence::run(js::gc::SweepAction::Args&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#13 0x00007ffff5202ae9 in sweepaction::SweepActionForEach<js::gc::SweepGroupsIter, JSRuntime*>::run(js::gc::SweepAction::Args&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#14 0x00007ffff51f9ee0 in js::gc::GCRuntime::performSweepActions(js::SliceBudget&) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#15 0x00007ffff51bdbbe in js::gc::GCRuntime::incrementalSlice(js::SliceBudget&, JS::GCReason, bool) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
--Type for more, q to quit, c to continue without paging--
#16 0x00007ffff51beefe in js::gc::GCRuntime::gcCycle(bool, js::SliceBudget const&, JS::GCReason) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#17 0x00007ffff51bf50e in js::gc::GCRuntime::collect(bool, js::SliceBudget const&, JS::GCReason) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#18 0x00007ffff51a9322 in js::gc::GCRuntime::gc(JS::GCOptions, JS::GCReason) ()
from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#19 0x00007ffff4eec874 in JSRuntime::destroyRuntime() () from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#20 0x00007ffff4e456a1 in js::DestroyContext(JSContext*) () from /home/philippe/Sources/PythonMonkey/python/pythonmonkey/libmozjs-115.so
#21 0x00007ffff6c6ec10 in cleanup () at /home/philippe/Sources/PythonMonkey/src/modules/pythonmonkey/pythonmonkey.cc:217
#22 0x00005555556b489d in call_ll_exitfuncs (runtime=) at Python/pylifecycle.c:2423
#23 Py_FinalizeEx () at Python/pylifecycle.c:1506
#24 0x00005555556b6ab6 in Py_FinalizeEx () at Python/pylifecycle.c:1350
#25 Py_Exit (sts=0) at Python/pylifecycle.c:2433
GC only happens when Spidermonkey thinks it's running out of mem, not too eagerly
What I'm really after is the code to detect we are finalizing at exit and cannot then call dec ref without crashing and cannot even call functions to tell us if we would crash if we called decref
The text was updated successfully, but these errors were encountered: