Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
bpo-21131: don't use SIGSTKSZ for stack size in sigaltstack #13649
Following up discussion on http://bugs.python.org/issue21131
vstinner suggested using the logic in
So, instead, I've rejigged the macros in that file to provide PLATFORM_STACK_SIZE and PLATFORM_STACK_PREFERRED that are available regardless of the ability of pthreads to set the thread stack size attribute (i.e., regardless of the presence of _POSIX_THREAD_ATTR_STACK_SIZE) (and simplified some of the conditionals in the code using THREAD_STACK_SIZE in the process). The eventual sizes past to
This is then used as a fallback in the new function,
If that call fails, or the thread size attribute is not available, we default to the maximum of PTHREAD_STACK_MIN, whatever we've defined for PLATFORM_STACK_SIZE for those platforms with an inadequate default stacksize, or finally the arbitrary 32k setting previously used as a floor.
All feedback gratefully appreciated.
Is there any chance that the priority of this could get promoted prior to the next release? This causes the FaultHandler test to segfault when compiling on the Skylake architecture. This seems somewhat serious, yet it's not been reviewed, and I think perhaps is should not be a type-enhancement but an actual bug?
Adding @ambv here in lieu of sending mail per the release candidate notes at
I just updated the Bug report at https://bugs.python.org/issue21131 to report that this only seems to apply when Python is configured to use shared libraries. Using
leads to the
I am not sure why that is, but it may explain some people's being unable to reproduce the problem.
vstinner left a comment
I'm not comfortable with this change since it modify the core thread module only to fix a faulthandler unit test. faulthandler uses SIGSTKSZ. It's not obvious to me how it relates to the "preferred thread stack size".
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.
Once you have made the requested changes, please leave a comment on this pull request containing the phrase