This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_recursion_limit in test_threading crashes with SIGSEGV on android
Type: crash Stage: resolved
Components: Tests Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2019-11-19 20:02 by xdegaye, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17337 merged xdegaye, 2019-11-22 10:33
Messages (4)
msg356988 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2019-11-19 20:02
Actually it is the script that is spawned by test_recursion_limit that crashes with SIGSEGV on android API 24. Lowering the recursion limit in the script from 1000 to 100 with sys.setrecursionlimit() fixes the problem.

Here is the error:

generic_x86_64:/data/local/tmp/python $ python -m test -v test_threading -m test_recursion_limit   
== CPython 3.9.0a0 (heads/abifa-dirty:cf805c25e6, Nov 18 2019, 16:40:26) [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
== Linux-3.10.0+-x86_64-with-libc little-endian
== cwd: /data/local/tmp/python/tmp/test_python_4603
== CPU count: 2
== encodings: locale=UTF-8, FS=utf-8
0:00:00 Run tests sequentially
0:00:00 [1/1] test_threading
test_recursion_limit (test.test_threading.ThreadingExceptionTests) ... FAIL

======================================================================
FAIL: test_recursion_limit (test.test_threading.ThreadingExceptionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/local/tmp/python/lib/python3.9/test/test_threading.py", line 1086, in test_recursion_limit
    self.assertEqual(p.returncode, 0, "Unexpected error: " + stderr.decode())
AssertionError: -11 != 0 : Unexpected error: 

----------------------------------------------------------------------

Ran 1 test in 0.148s

FAILED (failures=1)
test test_threading failed
test_threading failed

== Tests result: FAILURE ==

1 test failed:
    test_threading

Total duration: 354 ms
Tests result: FAILURE
msg357152 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2019-11-21 10:22
The crash occurs only on debug builds.

See the FreeBSD related issue #37906.
msg357266 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2019-11-22 10:36
Using test and try with _thread.stack_size(new_size), the pthread stack sizes must be set to the following minimums to prevent stack overflow and get a RecursionError:
  * debug builds:    7 Mb
  * no-debug builds: 1 Mb

The default stack size for the main thread does not need to be changed as test test_exceptions.ExceptionTests.testInfiniteRecursion is ok for both build types.

PR 17337 sets the thread stack size to 8 Mb for debug builds on android platforms.
msg357994 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-08 07:40
New changeset 00ada2c1d57c5b8b468bad32ff24fa14113ae5c7 by Victor Stinner (xdegaye) in branch 'master':
bpo-38852: Set thread stack size to 8 Mb for debug builds on android platforms (GH-17337)
https://github.com/python/cpython/commit/00ada2c1d57c5b8b468bad32ff24fa14113ae5c7
History
Date User Action Args
2022-04-11 14:59:23adminsetgithub: 83033
2021-09-07 19:21:55iritkatrielsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-12-10 07:43:40xdegayesetnosy: - xdegaye
2019-12-08 07:40:18vstinnersetnosy: + vstinner
messages: + msg357994
2019-11-22 10:36:36xdegayesetmessages: + msg357266
2019-11-22 10:33:44xdegayesetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request16821
2019-11-21 10:22:35xdegayesetmessages: + msg357152
2019-11-19 20:02:17xdegayecreate