From 2026e1259422d4e0cf92391ca2d3844356c649d0 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 14 Nov 2017 16:55:32 +0000 Subject: main/python3: increase thread stack size we segfault before we hit the sys.getrecurslimit(), which is bad. Some testing showed that to be able to reach the default sys.getrecurslimit(), which is 1000, we need at least a 453k stack on x86_64. We set it to 1MB so we have a bit extra. It is also worth to note that upstream set stacksize to 4MB on freebsd and 5MB on OSX. ref #8134 https://github.com/docker-library/python/issues/211 --- main/python3/APKBUILD | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'main/python3') diff --git a/main/python3/APKBUILD b/main/python3/APKBUILD index e6daf5e699..bc812ba54f 100644 --- a/main/python3/APKBUILD +++ b/main/python3/APKBUILD @@ -5,7 +5,7 @@ pkgname=python3 # the python2-tkinter's pkgver needs to be synchronized with this. pkgver=3.6.3 _basever="${pkgver%.*}" -pkgrel=7 +pkgrel=8 pkgdesc="A high-level scripting language" url="http://www.python.org" arch="all" @@ -56,11 +56,30 @@ build() { --with-system-ffi \ --with-threads - make EXTRA_CFLAGS="$CFLAGS" + # set thread stack size to 1MB so we don't segfault before we hit + # sys.getrecursionlimit() + make EXTRA_CFLAGS="$CFLAGS -DTHREAD_STACK_SIZE=0x100000" } check() { cd "$builddir" + + # test that we reach recursionlimit before we segfault + cat > test-stacksize.py <<-EOF + import threading + import sys + + def fun(i): + try: + fun(i+1) + except: + sys.exit(0) + + t = threading.Thread(target=fun, args=[1]) + t.start() +EOF + LD_LIBRARY_PATH=$PWD ./python test-stacksize.py + local fail # musl related -- cgit v1.2.3