Skip to content

gh-151542: Use at least 2 MiB stack size, instead of 1 MiB#151543

Draft
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:stack_size_2mib
Draft

gh-151542: Use at least 2 MiB stack size, instead of 1 MiB#151543
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:stack_size_2mib

Conversation

@vstinner

@vstinner vstinner commented Jun 16, 2026

Copy link
Copy Markdown
Member

Python needs at least 2 MiB stack to run test_threading on Free Threading.

Python needs at least 2 MiB stack to run test_threading on Free
Threading.
@kumaraditya303

Copy link
Copy Markdown
Contributor

Is there any downside to bump it to 8MB which is default on glibc?

@vstinner

Copy link
Copy Markdown
Member Author

Tests / Sanitizers / TSan (free-threading) (pull_request): Failing after 23m

Ah, that's the unrelated test_ssl issue gh-150191:

WARNING: ThreadSanitizer: data race (pid=19679)
  Read of size 8 at 0x720800031f80 by thread T11:
    #0 memcmp <null> (python+0x10a64e) (BuildId: 41036444ba804d65aa7dcf36ed904a99f126bd28)
    #1 ASN1_STRING_cmp <null> (libcrypto.so.3+0xd5904) (BuildId: 79b8e7622d14cb55e5704008d40c02423919bfae)
...

@vstinner

Copy link
Copy Markdown
Member Author

Python needs at least 2 MiB stack to run test_threading on Free Threading.

I created issue gh-151546 for the root cause: _Py_Dealloc() mechanism (_Py_RecursionLimit_GetMargin()) to avoid stack overflow doesn't work properly on musl.

@vstinner vstinner marked this pull request as draft June 16, 2026 15:29
@vstinner

Copy link
Copy Markdown
Member Author

This change is more a workaround than a fix for the root issue. I mark this PR as a draft for now.

I wrote #151548 to fix the root issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants