diff mbox series

python3: Increase default thread stack size on musl

Message ID 20230827002746.566276-1-raj.khem@gmail.com
State Accepted, archived
Commit 7f9c14aa51fe9180e56cc6922415aef873de9cb6
Headers show
Series python3: Increase default thread stack size on musl | expand

Commit Message

Khem Raj Aug. 27, 2023, 12:27 a.m. UTC
default stack size for threads is approx 140k on musl which is fine in
most cases but some of python apps e.g. python3-lz4 bindings run into
thread stack size overflow. Increase the default size to 2M on musl,
glibc defaults to 8M, so we are good there.

This default stack size change is limited to interpreter and stdlib
modules only, thats why CFLAGS_NODIST instead of CFLAGS

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/python/python3_3.11.4.bb | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/python/python3_3.11.4.bb b/meta/recipes-devtools/python/python3_3.11.4.bb
index 8fd1382caa4..ac4c6221ca3 100644
--- a/meta/recipes-devtools/python/python3_3.11.4.bb
+++ b/meta/recipes-devtools/python/python3_3.11.4.bb
@@ -91,6 +91,13 @@  CACHED_CONFIGUREVARS = " \
                 ac_cv_file__dev_ptc=no \
                 ac_cv_working_tzset=yes \
 "
+# set thread stack size to 2MB on musl for interpreter and stdlib C extensions
+# so it does not run into stack limits due to musl's small thread stack
+# This is only needed to build interpreter and not the subsequent modules
+# Thats why CFLAGS_NODIST is modified instead of CFLAGS
+CACHED_CONFIGUREVARS:append:libc-musl = "\
+    CFLAGS_NODIST='${CFLAGS} -DTHREAD_STACK_SIZE=0x200000' \
+"
 
 # PGO currently causes builds to not be reproducible so disable by default, see YOCTO #13407
 PACKAGECONFIG ??= "editline gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}"