GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-148260: Use at least 1 MiB stack size on musl by vstinner · Pull Request #149993 · python/cpython Conversation
|
|
On "AMD64 Alpine Linux NoGIL 3.x" buildbot, currently test_threading.test_recursion_limit() does crash with a stack overflow: issue gh-148260. With this change, Python is built with With this change, test_threading.test_recursion_limit() does pass. I tested Python built in debug mode ( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@corona10 @erlend-aasland @picnixz: I'm looking for autotools experts to review my configure.ac change. I'm not comfortable with changing the build system. Currently, the It seems like running a program is the only way to check if Python is linked to the musl library. My change is not specific to the musl library, but instead read the default thread stack size to decide if My configure.ac is inspired by Python 3.12 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| EOF | ||
|
|
||
| ac_cv_thread_stack_size="default" | ||
| if $CC -pthread $CFLAGS conftest.c -o conftest &>/dev/null; then |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I chose to use $CC -pthread to make sure that the pthread API can be used in the C program. We check if -pthread is supported above, near line 3064, which sets CC="$CC -pthread" if the flag is supported. I should maybe omit -pthread and move my code after the -pthread check.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think using -pthread explicitly is fine, it doesn't matter if it's passed to the compiler twice.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
!buildbot Alpine |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🤖 New build scheduled with the buildbot fleet by @zware for commit fd078ac 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F149993%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Cool, the test suite passed on Alpine Linux buildbots:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| EOF | ||
|
|
||
| ac_cv_thread_stack_size="default" | ||
| if $CC -pthread $CFLAGS conftest.c -o conftest &>/dev/null; then |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think using -pthread explicitly is fine, it doesn't matter if it's passed to the compiler twice.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ac_cv_thread_stack_size="default" | ||
| if $CC -pthread $CFLAGS conftest.c -o conftest &>/dev/null; then | ||
| ./conftest &>/dev/null | ||
| if test $? -eq 1; then |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
For debugging it would probably be nice if the output said whether the stack size is good enough, needs overriding or just unknown (return code 2)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The possible exit codes are:
The two possible outputs are:
checking for thread stack size... default if the stack size is already at least 1 MiBchecking for thread stack size... 1048576 if the stack size must be set to 1 MiB with LDFLAGSDo you mean that the error case should be rendered differently, such as "error"? Usually, it seems like configure ignores errors silently.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I mean I would like the output to be "checking for the thread stack size... unknown". It can keep behaving like 'default', but at least from the configure output it'll be more obvious it wasn't able to detect the actual thread size. But it's not a big deal if it's too tricky to get right.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ok, I modified the code to display "error" if gcc/clang failed to build the C program, or if the C program failed (exit code differently than 0 and 1).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
!buildbot Alpine |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit 86027a6 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F149993%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The worker is down at the moment; I had a storm-related power outage this morning and my UPS has not yet recharged enough to turn the host back on. It will be back by this afternoon. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
It works as expected:
On "AMD64 Alpine Linux NoGIL PR", test_threading crashed :-( But it passed when rerun... |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-150150 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…150150) gh-148260: Use at least 1 MiB stack size on musl (GH-149993) On Linux when Python is linked to the musl C library, use a thread stack size of at least 1 MiB instead of musl default which is 128 kiB. (cherry picked from commit df6c157) Co-authored-by: Victor Stinner <[email protected]>
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-151586 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…151586) gh-148260: Use at least 1 MiB stack size on musl (GH-149993) On Linux when Python is linked to the musl C library, use a thread stack size of at least 1 MiB instead of musl default which is 128 kiB. (cherry picked from commit df6c157) Co-authored-by: Victor Stinner <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.