Repository navigation
The REPL hangs under low memory on main #140080
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Oct 14, 2025 - changed the title
[-]The REPL hangs under no low memory on main[/-][+]The REPL hangs under low memory on main[/+]on Oct 14, 2025 - addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shellRelated to the interactive shell
on Oct 14, 2025 I don't think it's an issue actually. If the system is constrained to low memory, it's maybe really hard to know when to exit the interpreter (as you see it's probably when shutting it down, and we definitely need some memory I guess here). I would suggest closing this as
not planned.- addedpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
on Oct 14, 2025 I don't think it's an issue actually. If the system is constrained to low memory, it's maybe really hard to know when to exit the interpreter. I would suggest closing this as
not planned(also, the_testcapi.set_nomemory(0)is not meant for real-code usage, just to mimic low memory units).copy but it turns out #134163 is a real one and can reproduce without repl
the question is maybe it under low memory and hangs or only in repl if only in repl close is better
- removedpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
on Oct 14, 2025 In hindsight, we should have put the test case from #138491 on main and 3.14. A good start would be to bisect which commit is bad.
In hindsight, we should have put the test case from #138491 on main and 3.14. A good start would be to bisect which commit is bad.
the tests not a reproducer
and will help to bisect later@ZeroIntensity this commit bring the problem 2191497
Oh, ha, that's my PR. I'll look into it later, unless you want to try it yourself.
Oh, ha, that's my PR. I'll look into it later, unless you want to try it yourself.
I make a patch fix it its very interesting, but I am not sure it needs a test(which is hard)
in
atexit_callfuncs- PyList_GetSlice(...).
- If this operation fails due to low memory
- PyErr_FormatUnraisable() is called, and the function returns directly.
- state->callbacks list not empty
- In
make_pre_finalization_calls->interp_has_atexit_callbacks()return true forever - then loop
- added a commit that references this issue
on Oct 15, 2025 Thanks @yihong0618!
- added a commit that references this issue
on Oct 15, 2025
Bug report
Bug description:
Its kind of the same issue like #134163
so cc @ZeroIntensity @picnixz
but the root cause is very different
it will print the error and hang forever
the root cause is easy but the fix maybe hard and need to discuss so only issue
and digging here no patch
some dig:
the root cause can check bt
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs