-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite recursion tests triggering a segfault #62275
Comments
If you run any test that has infinite recursion (test_json test_exceptions test_sys test_runpy) it will segfault with a fresh checkout under OS X 10.8.3 using Clang. Not sure how widespread this is. I did check that I am using a clean checkout of the default branch. |
I can confirm the problem. It appears to be a stack overflow, when I increase the stack size of the main thead (by adding "-Wl,-stack_size,2faf000" to the link command for BUILDPYTHON) the crash in test_json goes away. Appearently the default maximum stack size isn't large enough for the default value of the recursion limit. An easy workaround (fix?) would be to add -Wl,-stack_size,VALUE to the link flags on OSX, for some sane value of VALUE. The value is the maximum size of the stack of the main thread and doesn't affect process size unless a process actually uses more stack space. It does affect the available free address space, and hence the maximum stack size shouldn't be increased too far (especially for 32-bit builds) |
The attached patch fixes the problem on OSX by increasing the maximum stack size of the main thread from 8M (the default) to 16M. NOTE: The -Wl,-stack_size,... option cannot be added to LDFLAGS, ld errors out when that option is used when linking a shared library (such as the extensions or libpython.dylib) |
The update fixes the name error mention in rietveld. |
LGTM |
Why not changing the recursion limit instead of the size of the stack? |
I'd prefer to keep the default recursion limit the same as on Linux, changing the recursion limit on OSX would just introduce an unnecessary difference between the two platforms. The patch changes the maximum stack size from 8 to 16 MByte, neither of which is huge and shouldn't cause other problems. I'd also like to increase the default stack size for newly created threads (see bpo-18049) and will update that patch to create a 16 MByte stack as well. |
On Mac OS X: Is the memory allocated at Python startup, or on demand, 2013/5/30 Ronald Oussoren <report@bugs.python.org>:
|
On 30 May, 2013, at 14:50, STINNER Victor <report@bugs.python.org> wrote:
Memory for the stack is allocated on demand, the parameter sets the maximum size that the stack can grow to. See also man ld(1). Ronald |
New changeset b07ad4b5e349 by Łukasz Langa in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: