Bug 1181064

Summary: python segfaults when running test_code_module
Product: [Fedora] Fedora Reporter: Dan Horák <dan>
Component: python3Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 22CC: bkabrda, jberan, orion, tomspur, vladimir.rusinov
Target Milestone: ---   
Target Release: ---   
Hardware: s390x   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 20:20:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 467765    

Description Dan Horák 2015-01-12 10:17:05 UTC
python segfaults when running test_code_module locally

...
[ 52/390/3] test_code_module
test_banner (test.test_code_module.TestInteractiveConsole) ... ok
test_console_stderr (test.test_code_module.TestInteractiveConsole) ... ok
test_ps1 (test.test_code_module.TestInteractiveConsole) ... ok
test_ps2 (test.test_code_module.TestInteractiveConsole) ... ok
test_syntax_error (test.test_code_module.TestInteractiveConsole) ... Fatal Python error: Segmentation fault

Current thread 0x000003fffca7e710 (most recent call first):
  File "<frozen importlib._bootstrap>", line 321 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1715 in load_module
  File "<frozen importlib._bootstrap>", line 539 in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1161 in _load_backward_compatible
  File "<frozen importlib._bootstrap>", line 1191 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 2226 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 2237 in _find_and_load
  File "/usr/lib64/python3.4/site-packages/systemd/journal.py", line 34 in <module>
  File "<frozen importlib._bootstrap>", line 321 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1471 in exec_module
  File "<frozen importlib._bootstrap>", line 1129 in _exec
  File "<frozen importlib._bootstrap>", line 1200 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 2226 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 2237 in _find_and_load
  File "<frozen importlib._bootstrap>", line 321 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 2284 in _handle_fromlist
  File "/usr/lib64/python3.4/site-packages/abrt_exception_handler3.py", line 30 in syslog
  File "/usr/lib64/python3.4/site-packages/abrt_exception_handler3.py", line 164 in handle_exception
  File "/usr/lib64/python3.4/site-packages/abrt_exception_handler3.py", line 220 in <lambda>
  File "/home/sharkcz/python3/Python-3.4.2/Lib/unittest/mock.py", line 966 in _mock_call
  File "/home/sharkcz/python3/Python-3.4.2/Lib/unittest/mock.py", line 896 in __call__
  File "/home/sharkcz/python3/Python-3.4.2/Lib/code.py", line 157 in showtraceback
  File "/home/sharkcz/python3/Python-3.4.2/Lib/code.py", line 94 in runcode
  File "/home/sharkcz/python3/Python-3.4.2/Lib/code.py", line 74 in runsource
  File "/home/sharkcz/python3/Python-3.4.2/Lib/code.py", line 256 in push
  File "/home/sharkcz/python3/Python-3.4.2/Lib/code.py", line 234 in interact
  File "/home/sharkcz/python3/Python-3.4.2/Lib/test/test_code_module.py", line 52 in test_syntax_error
  File "/home/sharkcz/python3/Python-3.4.2/Lib/unittest/case.py", line 615 in run
  File "/home/sharkcz/python3/Python-3.4.2/Lib/unittest/case.py", line 663 in __call__
  File "/home/sharkcz/python3/Python-3.4.2/Lib/unittest/suite.py", line 125 in run
  File "/home/sharkcz/python3/Python-3.4.2/Lib/unittest/suite.py", line 87 in __call__
  File "/home/sharkcz/python3/Python-3.4.2/Lib/unittest/suite.py", line 125 in run
  File "/home/sharkcz/python3/Python-3.4.2/Lib/unittest/suite.py", line 87 in __call__
  File "/home/sharkcz/python3/Python-3.4.2/Lib/unittest/runner.py", line 168 in run
  File "/home/sharkcz/python3/Python-3.4.2/Lib/test/support/__init__.py", line 1751 in _run_suite
  File "/home/sharkcz/python3/Python-3.4.2/Lib/test/support/__init__.py", line 1785 in run_unittest
  File "/home/sharkcz/python3/Python-3.4.2/Lib/test/test_code_module.py", line 83 in test_main
  File "/home/sharkcz/python3/Python-3.4.2/Lib/test/regrtest.py", line 1280 in runtest_inner
  File "/home/sharkcz/python3/Python-3.4.2/Lib/test/regrtest.py", line 978 in runtest
  File "/home/sharkcz/python3/Python-3.4.2/Lib/test/regrtest.py", line 763 in main
  File "/home/sharkcz/python3/Python-3.4.2/Lib/test/regrtest.py", line 1564 in main_in_temp_cwd
  File "/home/sharkcz/python3/Python-3.4.2/Lib/test/regrtest.py", line 1589 in <module>
  File "/home/sharkcz/python3/Python-3.4.2/Lib/runpy.py", line 85 in _run_code
  File "/home/sharkcz/python3/Python-3.4.2/Lib/runpy.py", line 170 in _run_module_as_main
/var/tmp/rpm-tmp.CAt8zW: line 40: 61401 Segmentation fault      WITHIN_PYTHON_RPM_BUILD= LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest --verbose --findleaks
error: Bad exit status from /var/tmp/rpm-tmp.CAt8zW (%check)



Version-Release number of selected component (if applicable):
python3-3.4.2-3.fc22, but also happens with python2

Steps to Reproduce:
1. fedpkg local

Comment 1 Jaroslav Reznik 2015-03-03 16:42:14 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 2 Fedora Admin XMLRPC Client 2015-05-12 12:03:09 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Orion Poplawski 2015-09-14 20:50:56 UTC
I can reproduce this in F21 as well, and I suspect this is preventing new python3 builds for F21 and F22.

$ WITHIN_PYTHON_RPM_BUILD= LD_LIBRARY_PATH=build/debug valgrind build/debug/python -m test.regrtest  --verbose --findleaks  test_code_module
==9013== Memcheck, a memory error detector
==9013== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==9013== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==9013== Command: build/debug/python -m test.regrtest --verbose --findleaks test_code_module
==9013== 
== CPython 3.4.1 (default, Sep 14 2015, 13:28:47) [GCC 4.9.2 20150212 (Red Hat 4.9.2-6)]
==   Linux-4.1.6-100.fc21.x86_64-x86_64-with-fedora-21-Twenty_One little-endian
==   hash algorithm: siphash24 64bit
==   /export/home/orion/fedora/python3/Python-3.4.1/build/test_python_9013
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
[1/1] test_code_module
test_banner (test.test_code_module.TestInteractiveConsole) ... ok
test_console_stderr (test.test_code_module.TestInteractiveConsole) ... ok
test_ps1 (test.test_code_module.TestInteractiveConsole) ... ok
test_ps2 (test.test_code_module.TestInteractiveConsole) ... ok
test_syntax_error (test.test_code_module.TestInteractiveConsole) ... ==9013== Invalid read of size 8
==9013==    at 0x4F0D8DC: _PyType_Lookup (typeobject.c:2723)
==9013==    by 0x4F0E34C: lookup_maybe (typeobject.c:1338)
==9013==    by 0x4F1057D: lookup_method (typeobject.c:1352)
==9013==    by 0x4F1698D: mro_internal (typeobject.c:1740)
==9013==    by 0x4F1355F: PyType_Ready (typeobject.c:4659)
==9013==    by 0x14ED9082: PyModule_Create2 (in /usr/lib64/libpython3.4m.so.1.0)
==9013==    by 0x4029F71: PyInit__journal (in /usr/lib64/python3.4/site-packages/systemd/_journal.so)
==9013==  Address 0x656c706d69202940 is not stack'd, malloc'd or (recently) free'd
==9013== 
Fatal Python error: Segmentation fault

Current thread 0x000000000405fe00 (most recent call first):
  File "<frozen importlib._bootstrap>", line 321 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1715 in load_module
  File "<frozen importlib._bootstrap>", line 539 in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1161 in _load_backward_compatible
  File "<frozen importlib._bootstrap>", line 1191 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 2226 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 2237 in _find_and_load
  File "/usr/lib64/python3.4/site-packages/systemd/journal.py", line 34 in <module>
  File "<frozen importlib._bootstrap>", line 321 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1471 in exec_module
  File "<frozen importlib._bootstrap>", line 1129 in _exec
  File "<frozen importlib._bootstrap>", line 1200 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 2226 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 2237 in _find_and_load
  File "<frozen importlib._bootstrap>", line 321 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 2284 in _handle_fromlist
  File "/usr/lib64/python3.4/site-packages/abrt_exception_handler3.py", line 30 in syslog
  File "/usr/lib64/python3.4/site-packages/abrt_exception_handler3.py", line 164 in handle_exception
  File "/usr/lib64/python3.4/site-packages/abrt_exception_handler3.py", line 220 in <lambda>
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/unittest/mock.py", line 966 in _mock_call
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/unittest/mock.py", line 896 in __call__
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/code.py", line 157 in showtraceback
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/code.py", line 94 in runcode
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/code.py", line 74 in runsource
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/code.py", line 256 in push
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/code.py", line 234 in interact
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/test/test_code_module.py", line 52 in test_syntax_error
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/unittest/case.py", line 615 in run
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/unittest/case.py", line 663 in __call__
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/unittest/suite.py", line 125 in run
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/unittest/suite.py", line 87 in __call__
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/unittest/suite.py", line 125 in run
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/unittest/suite.py", line 87 in __call__
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/unittest/runner.py", line 168 in run
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/test/support/__init__.py", line 1731 in _run_suite
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/test/support/__init__.py", line 1765 in run_unittest
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/test/test_code_module.py", line 83 in test_main
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/test/regrtest.py", line 1278 in runtest_inner
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/test/regrtest.py", line 978 in runtest
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/test/regrtest.py", line 763 in main
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/test/regrtest.py", line 1562 in main_in_temp_cwd
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/test/regrtest.py", line 1587 in <module>
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/runpy.py", line 85 in _run_code
  File "/export/home/orion/fedora/python3/Python-3.4.1/Lib/runpy.py", line 170 in _run_module_as_main
==9013==
==9013== HEAP SUMMARY:
==9013==     in use at exit: 16,999,798 bytes in 87,546 blocks
==9013==   total heap usage: 238,812 allocs, 151,266 frees, 53,290,218 bytes allocated
==9013==
==9013== LEAK SUMMARY:
==9013==    definitely lost: 0 bytes in 0 blocks
==9013==    indirectly lost: 0 bytes in 0 blocks
==9013==      possibly lost: 16,834,855 bytes in 84,465 blocks
==9013==    still reachable: 164,943 bytes in 3,081 blocks
==9013==         suppressed: 0 bytes in 0 blocks
==9013== Rerun with --leak-check=full to see details of leaked memory
==9013==
==9013== For counts of detected and suppressed errors, rerun with: -v
==9013== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)

test_syntax_error (test.test_code_module.TestInteractiveConsole) ... Detaching after fork from child process 9320.

Program received signal SIGSEGV, Segmentation fault.
_PyType_Lookup (type=0x7fffea5c2301, name=0x7ffff7f7ac70)
    at /export/home/orion/fedora/python3/Python-3.4.1/Objects/typeobject.c:2723
2723        assert(PyTuple_Check(mro));
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.6-14.fc21.x86_64 elfutils-libelf-0.163-1.fc21.x86_64 elfutils-libs-0.163-1.fc21.x86_64 keyutils-libs-1.5.9-4.fc21.x86_64 krb5-libs-1.12.2-17.fc21.x86_64 libcom_err-1.42.12-4.fc21.x86_64 libffi-3.1-7.fc21.x86_64 libgcrypt-1.6.3-4.fc21.x86_64 libgpg-error-1.17-2.fc21.x86_64 libselinux-2.3-10.fc21.x86_64 libuuid-2.25.2-3.fc21.x86_64 openssl-libs-1.0.1k-12.fc21.x86_64 pcre-8.35-14.fc21.x86_64 python3-libs-3.4.1-16.fc21.x86_64 systemd-libs-216-25.fc21.x86_64 systemd-python3-216-25.fc21.x86_64 xz-libs-5.1.2-14alpha.fc21.x86_64 zlib-1.2.8-7.fc21.x86_64
(gdb) bt
#0  _PyType_Lookup (type=0x7fffea5c2301, name=0x7ffff7f7ac70)
    at /export/home/orion/fedora/python3/Python-3.4.1/Objects/typeobject.c:2723
#1  0x00007ffff799032d in _PyType_LookupId (type=<optimized out>, name=<optimized out>)
    at /export/home/orion/fedora/python3/Python-3.4.1/Objects/typeobject.c:2754
#2  0x00007ffff799034d in lookup_maybe (self=0x7fffea858ac0, attrid=<optimized out>)
    at /export/home/orion/fedora/python3/Python-3.4.1/Objects/typeobject.c:1338
#3  0x00007ffff799257e in lookup_method (self=<optimized out>,
    attrid=0x7ffff7d7c880 <PyId_mro.11924>)
    at /export/home/orion/fedora/python3/Python-3.4.1/Objects/typeobject.c:1352
#4  0x00007ffff799898e in mro_internal (type=type@entry=0x7fffea858ac0)
    at /export/home/orion/fedora/python3/Python-3.4.1/Objects/typeobject.c:1740
#5  0x00007ffff7995560 in PyType_Ready (type=0x7fffea858ac0)
    at /export/home/orion/fedora/python3/Python-3.4.1/Objects/typeobject.c:4659
#6  0x00007fffea4c8083 in PyModule_Create2 () from /lib64/libpython3.4m.so.1.0
#7  0x00007ffff7fecf72 in PyInit__journal ()
   from /usr/lib64/python3.4/site-packages/systemd/_journal.so
#8  0x0000000000000000 in ?? ()
(gdb) list
2718
2719        res = NULL;
2720        /* keep a strong reference to mro because type->tp_mro can be replaced
2721           during PyDict_GetItem(dict, name)  */
2722        Py_INCREF(mro);
2723        assert(PyTuple_Check(mro));
2724        n = PyTuple_GET_SIZE(mro);
2725        for (i = 0; i < n; i++) {
2726            base = PyTuple_GET_ITEM(mro, i);
2727            assert(PyType_Check(base));
(gdb) print *mro
Cannot access memory at address 0x656c706d69202928

Comment 4 Orion Poplawski 2015-09-14 21:20:51 UTC
Just to be explicit - this is holding up getting the %py3_build/install macros into F21.

Comment 5 Fedora Admin XMLRPC Client 2016-01-29 13:08:00 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Fedora End Of Life 2016-07-19 20:20:52 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.