aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-11-14 16:55:32 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2017-11-14 17:05:56 +0000
commit2026e1259422d4e0cf92391ca2d3844356c649d0 (patch)
treee781271d04301753224f830394f4a0bfd3e207e2
parent4e8e97f9dc83012d4ae40058a832f4765e4969f4 (diff)
downloadaports-2026e1259422d4e0cf92391ca2d3844356c649d0.tar.bz2
aports-2026e1259422d4e0cf92391ca2d3844356c649d0.tar.xz
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
-rw-r--r--main/python3/APKBUILD23
1 files changed, 21 insertions, 2 deletions
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