Message403184
I left some comments on the PR. We can at least make it detect musl libc and improve its default behavior there.
FWIW CPython's recursionlimit and the C stack have long been a thorn in the side of many things.
Even when Python's thread_pthread.h is changed to set a better default when running under musl libc, there are still plenty of ways to run into problems. ex: Extension modules can create threads on their own that then call back into CPython. So can C/C++ code that embeds a Python interpreter. Those choose their own stack sizes. When they choose low values, surprising crashes ensue for people working on the Python side...
As a feature (beyond just this issue): It'd be ideal to actually be able to introspect the C stack space remaining and issue a RecursionError whenever it falls below a threshold. Rather than just blindly using a runtime adjustable number that any Python code can tweak to allow crashes via `sys.setrecursionlimit()`. Other languages like Golang use a dynamic stack and allocate more on SIGSEGV.
[meta/off-topic: Why does anyone use small thread stack sizes? This is often done to save virtual address space in applications that expect to have thousands of threads. It matters a lot less on 64-bit address space. But there are reasons...] |
|
Date |
User |
Action |
Args |
2021-10-04 22:00:29 | gregory.p.smith | set | recipients:
+ gregory.p.smith, r.david.murray, python-dev, Natanael Copa, 4-launchpad-kalvdans-no-ip-org |
2021-10-04 22:00:28 | gregory.p.smith | set | messageid: <1633384828.97.0.0746857277666.issue32307@roundup.psfhosted.org> |
2021-10-04 22:00:28 | gregory.p.smith | link | issue32307 messages |
2021-10-04 22:00:28 | gregory.p.smith | create | |
|