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 Natanael Copa
Recipients Natanael Copa, r.david.murray
Date 2017-12-14.12:52:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513255959.51.0.213398074469.issue32307@psf.upfronthosting.co.za>
In-reply-to
Content
With "bad assumption" I mean that currently the code assumes that all unknown systems has big enough default thread stack size. This would not be a "bad assumption" if POSIX (or any other standard) would specify a requirement on the default stack size. To my understanding, there are no such requirement in the spec, and thus, applications can not really assume anything about the default thread stack size.

musl libc does not provide any __MUSL__ macro by design, because they consider "it’s a bug to assume a certain implementation has particular properties rather than testing" so we cannot really make exception for musl.

https://wiki.musl-libc.org/faq.html#Q:_Why_is_there_no_<code>__MUSL__</code>_macro?

I think the options we have are:
- at run time, use pthread_attr_getstacksize() to verify we have enough stack size. I don't know how to calculate the proper minimum, but some testing showed that we need 450k on musl x86_64 to reach sys.getrecursionlimit() so I'd say 1MB is a good limit - atleast for x86_64.
- at build time, run pthread_attr_getstacksize() from configure script to detect default stack size. This will not work for cross compile.
- reverse the current #ifdef behavior so that we check for known systems that has big enough system default (eg __GLIBC__ etc) and then fall back to something safe for everything else.
- Do nothing. Systems with low stack needs to figure out to add -DTHREAD_STACK_SIZE=0x100000 to the CFLAGS (this is what Alpine does right now)

I can of course make a check for musl in the configure script and special case it, but it still does not fix the issue: There is no guarantee that stack size is big enough for python's use for every existing and unknown future system.
History
Date User Action Args
2017-12-14 12:52:39Natanael Copasetrecipients: + Natanael Copa, r.david.murray
2017-12-14 12:52:39Natanael Copasetmessageid: <1513255959.51.0.213398074469.issue32307@psf.upfronthosting.co.za>
2017-12-14 12:52:39Natanael Copalinkissue32307 messages
2017-12-14 12:52:39Natanael Copacreate