Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_recursion_limit in test_threading crashes with SIGSEGV on android #83033

Closed
xdegaye mannequin opened this issue Nov 19, 2019 · 4 comments
Closed

test_recursion_limit in test_threading crashes with SIGSEGV on android #83033

xdegaye mannequin opened this issue Nov 19, 2019 · 4 comments
Labels
3.9 only security fixes tests Tests in the Lib/test dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented Nov 19, 2019

BPO 38852
Nosy @vstinner
PRs
  • bpo-38852: Set thread stack size to 8 Mb for debug builds on android platforms #17337
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-09-07.19:21:55.544>
    created_at = <Date 2019-11-19.20:02:16.792>
    labels = ['tests', '3.9', 'type-crash']
    title = 'test_recursion_limit in test_threading crashes with SIGSEGV on android'
    updated_at = <Date 2021-09-07.19:21:55.543>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2021-09-07.19:21:55.543>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-09-07.19:21:55.544>
    closer = 'iritkatriel'
    components = ['Tests']
    creation = <Date 2019-11-19.20:02:16.792>
    creator = 'xdegaye'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38852
    keywords = ['patch']
    message_count = 4.0
    messages = ['356988', '357152', '357266', '357994']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['17337']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue38852'
    versions = ['Python 3.9']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 19, 2019

    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

    @xdegaye xdegaye mannequin added 3.9 only security fixes tests Tests in the Lib/test dir type-crash A hard crash of the interpreter, possibly with a core dump labels Nov 19, 2019
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 21, 2019

    The crash occurs only on debug builds.

    See the FreeBSD related issue bpo-37906.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 22, 2019

    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.

    @vstinner
    Copy link
    Member

    vstinner commented Dec 8, 2019

    New changeset 00ada2c by Victor Stinner (xdegaye) in branch 'master':
    bpo-38852: Set thread stack size to 8 Mb for debug builds on android platforms (GH-17337)
    00ada2c

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes tests Tests in the Lib/test dir type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants