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.

Author gregory.p.smith
Recipients 4-launchpad-kalvdans-no-ip-org, Natanael Copa, gregory.p.smith, python-dev, r.david.murray
Date 2021-10-04.22:00:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1633384828.97.0.0746857277666.issue32307@roundup.psfhosted.org>
In-reply-to
Content
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...]
History
Date User Action Args
2021-10-04 22:00:29gregory.p.smithsetrecipients: + gregory.p.smith, r.david.murray, python-dev, Natanael Copa, 4-launchpad-kalvdans-no-ip-org
2021-10-04 22:00:28gregory.p.smithsetmessageid: <1633384828.97.0.0746857277666.issue32307@roundup.psfhosted.org>
2021-10-04 22:00:28gregory.p.smithlinkissue32307 messages
2021-10-04 22:00:28gregory.p.smithcreate