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

"AMD64 OpenIndiana 3.x" buildbot: assertion failed in PyObject_Call() in test_subprocess.test_preexec() #66486

Closed
vstinner opened this issue Aug 27, 2014 · 8 comments

Comments

@vstinner
Copy link
Member

BPO 22290
Nosy @vstinner
Files
  • fork_exec.patch
  • 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 2014-10-05.15:31:54.954>
    created_at = <Date 2014-08-27.13:11:23.335>
    labels = []
    title = '"AMD64 OpenIndiana 3.x" buildbot: assertion failed in PyObject_Call() in test_subprocess.test_preexec()'
    updated_at = <Date 2014-10-05.15:31:54.952>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2014-10-05.15:31:54.952>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-10-05.15:31:54.954>
    closer = 'vstinner'
    components = []
    creation = <Date 2014-08-27.13:11:23.335>
    creator = 'vstinner'
    dependencies = []
    files = ['36541']
    hgrepos = []
    issue_num = 22290
    keywords = ['patch']
    message_count = 8.0
    messages = ['225984', '225985', '226251', '226388', '226389', '226391', '228581', '228582']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue22290'
    versions = []

    @vstinner
    Copy link
    Member Author

    I ran test_subprocess.test_preexec() 2000 times: I'm unable to reproduce the issue on my OpenIndiana VM, nor on Linux. I used this command:
    gdb -args ./python -m test -F -m test_preexec test_subprocess

    The command on the buildbot is:
    ./python ./Tools/scripts/run_tests.py -j 1 -u all -W --timeout=3600 -j4

    http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%203.x/builds/8549/steps/test/logs/stdio

    [302/390/1] test_subprocess
    Assertion failed: (result != NULL && !PyErr_Occurred()) || (result == NULL && PyErr_Occurred()), file Objects/abstract.c, line 2091
    Fatal Python error: Aborted

    Current thread 0x0000000000000001 (most recent call first):
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/subprocess.py", line 1396 in _execute_child
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/subprocess.py", line 865 in __init__
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_subprocess.py", line 1303 in test_preexec
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/case.py", line 577 in run
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/case.py", line 625 in __call__
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/suite.py", line 125 in run
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/suite.py", line 87 in __call__
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/suite.py", line 125 in run
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/suite.py", line 87 in __call__
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/runner.py", line 168 in run
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/support/init.py", line 1750 in _run_suite
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/support/init.py", line 1784 in run_unittest
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_subprocess.py", line 2470 in test_main
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py", line 1280 in runtest_inner
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py", line 967 in runtest
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py", line 532 in main
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py", line 1564 in main_in_temp_cwd
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py", line 1589 in <module>
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/runpy.py", line 85 in _run_code
    File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/runpy.py", line 170 in _run_module_as_main

    @vstinner
    Copy link
    Member Author

    The error may be close to the call to the gc module: gc.isenabled(), gc.disable() or gc.enable(). The error is maybe an exception raised before the call to PyObject_Call(), because the called gc functions are very simple.

    @vstinner
    Copy link
    Member Author

    vstinner commented Sep 1, 2014

    Oh, a lot of tests fail with MemoryError on this buildbot. It may explain this issue.

    For example, test_json crashed with SIGSEGV in this build, probably because of an unhandled MemoryError exception:
    http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%203.x/builds/8557/steps/test/logs/stdio

    @vstinner
    Copy link
    Member Author

    vstinner commented Sep 4, 2014

    I reproduced the crash with pyfailmalloc. The problem is that _posixsubprocess.fork_exec() calls gc.enable() on error when preexec_fn is set and the garbage collector was disabled (by fork_exec). Calling a function with an exception set is forbidden.

    Attached patch fixes this issue, but fix also error handling in fork_exec() and add some unit tests.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 4, 2014

    New changeset 16e3d240456f by Victor Stinner in branch 'default':
    Issue bpo-22290: PyObject_Call() now fails with an assertion error when called
    http://hg.python.org/cpython/rev/16e3d240456f

    @vstinner
    Copy link
    Member Author

    vstinner commented Sep 4, 2014

    For example, test_json crashed with SIGSEGV in this build, probably because of an unhandled MemoryError exception:

    I created an issue for this bug: issue bpo-22338. I proposed a fix.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 5, 2014

    New changeset 0455cbfd7ae6 by Victor Stinner in branch '3.4':
    Issue bpo-22290: Fix error handling in the _posixsubprocess module.
    https://hg.python.org/cpython/rev/0455cbfd7ae6

    New changeset a74c73477a64 by Victor Stinner in branch 'default':
    (Merge 3.4) Issue bpo-22290: Fix error handling in the _posixsubprocess module.
    https://hg.python.org/cpython/rev/a74c73477a64

    @vstinner
    Copy link
    Member Author

    vstinner commented Oct 5, 2014

    I hope that my fix will be enough to fix the issue. Since it was only seen once, I prefer to close the issue.

    By the way, it would be nice to give more memory to this buildbot!

    @vstinner vstinner closed this as completed Oct 5, 2014
    @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
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant