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.

Author Timothy Lusk
Recipients Timothy Lusk
Date 2019-06-27.19:15:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561662908.45.0.299722199579.issue37434@roundup.psfhosted.org>
In-reply-to
Content
Alright I was finally able to reproduce the issue with a small code snip and capture the stack in gdb.  It looks like the issue has something to do with an exception thrown while importing a class (and possibly only when the class is a c_ext, but I haven't confirmed that)

[933fdf38d838">root@933fdf38d838 ~]# python3.7 -m venv crash-test
[933fdf38d838">root@933fdf38d838 ~]# crash-test/bin/pip install protobuf
Looking in indexes: https://files.pythonhosted.org/simple
Collecting protobuf
  Downloading https://files.pythonhosted.org/packages/ce/86/9f6123c4c6f481862f286dbe13aa2e97bdedd7662f5fc3033c1a41f32f88/protobuf-3.8.0-cp37-cp37m-manylinux1_x86_64.whl (1.2MB)
    100% |████████████████████████████████| 1.2MB 2.3MB/s 
Collecting six>=1.9 (from protobuf)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in ./crash-test/lib/python3.7/site-packages (from protobuf) (40.8.0)
Installing collected packages: six, protobuf
Successfully installed protobuf-3.8.0 six-1.12.0
[933fdf38d838">root@933fdf38d838 ~]# scl enable devtoolset-8 "gdb ./crash-test/bin/python"
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-2.el6
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./crash-test/bin/python...Reading symbols from /usr/lib/debug/usr/bin/python3.7m.debug...
warning: Skipping deprecated .gdb_index section in /usr/lib/debug/usr/bin/python3.7m.debug.
Do "set use-deprecated-index-sections on" before the file is read
to use the section anyway.
done.
done.
(gdb) run
Starting program: /root/crash-test/bin/python 
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.212.el6.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Python 3.7.3 (default, Jun 27 2019, 15:27:42) 
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> import gc
>>> 
>>> gc.disable()
>>> 
>>> for i in range(100):
...     warnings.filterwarnings('error')
...     try:
...         from google.protobuf.pyext import _message
...     except Exception as ex:
...         print(i)
...     
...     gc.collect()
... 
0
1
2
3
4
5

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7922ae5 in type_dealloc (type=0x7ffff2277480) at /usr/src/debug/Python-3.7.3/Objects/typeobject.c:3283
3283	    _PyObject_GC_UNTRACK(type);
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.5-7.el6_0.x86_64 expat-2.0.1-13.el6_8.x86_64 libgcc-4.4.7-23.el6.x86_64 libstdc++-4.4.7-23.el6.x86_64 ncurses-libs-5.7-4.20090207.el6.x86_64 nss-softokn-freebl-3.14.3-23.3.el6_8.x86_64 openresty-openssl-1.0.2s-1.el6.x86_64 readline-6.0-4.el6.x86_64 xz-libs-4.999.9-0.5.beta.20091007git.el6.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) bt
#0  0x00007ffff7922ae5 in type_dealloc (type=0x7ffff2277480) at /usr/src/debug/Python-3.7.3/Objects/typeobject.c:3283
#1  0x00007ffff78ee721 in free_keys_object (keys=0x7ffff64e3bc0) at /usr/src/debug/Python-3.7.3/Objects/dictobject.c:559
#2  0x00007ffff78f20af in dict_dealloc (mp=0x7ffff47a1708) at /usr/src/debug/Python-3.7.3/Objects/dictobject.c:1913
#3  0x00007ffff7904d15 in module_clear (m=0x7ffff22f3ea8) at /usr/src/debug/Python-3.7.3/Objects/moduleobject.c:749
#4  0x00007ffff7a3aeda in delete_garbage (collectable=0x7fffffffc250, old=0x7ffff7dd75f0 <_PyRuntime+400>)
    at /usr/src/debug/Python-3.7.3/Modules/gcmodule.c:769
#5  0x00007ffff7a3b41d in collect (generation=2, n_collected=0x7fffffffc2b8, n_uncollectable=0x7fffffffc2c0, nofail=0)
    at /usr/src/debug/Python-3.7.3/Modules/gcmodule.c:924
#6  0x00007ffff7a3b845 in collect_with_callback (generation=2) at /usr/src/debug/Python-3.7.3/Modules/gcmodule.c:1036
#7  0x00007ffff7a3bcef in gc_collect_impl (module=0x7ffff61f6138, generation=2)
    at /usr/src/debug/Python-3.7.3/Modules/gcmodule.c:1138
#8  0x00007ffff7a3ba13 in gc_collect (module=0x7ffff61f6138, args=0x7ffff64e7768, nargs=0, kwnames=0x0)
    at /usr/src/debug/Python-3.7.3/Modules/clinic/gcmodule.c.h:100
#9  0x00007ffff78b48e5 in _PyMethodDef_RawFastCallKeywords (method=0x7ffff7d8b800 <GcMethods+256>, self=0x7ffff61f6138, 
    args=0x7ffff64e7768, nargs=0, kwnames=0x0) at /usr/src/debug/Python-3.7.3/Objects/call.c:656
#10 0x00007ffff78b4bab in _PyCFunction_FastCallKeywords (func=0x7ffff61f8438, args=0x7ffff64e7768, nargs=0, kwnames=0x0)
    at /usr/src/debug/Python-3.7.3/Objects/call.c:730
#11 0x00007ffff79cbf2c in call_function (pp_stack=0x7fffffffc6e8, oparg=0, kwnames=0x0)
    at /usr/src/debug/Python-3.7.3/Python/ceval.c:4568
#12 0x00007ffff79c6344 in _PyEval_EvalFrameDefault (f=0x7ffff64e75e8, throwflag=0) at /usr/src/debug/Python-3.7.3/Python/ceval.c:3093
#13 0x00007ffff79b8067 in PyEval_EvalFrameEx (f=0x7ffff64e75e8, throwflag=0) at /usr/src/debug/Python-3.7.3/Python/ceval.c:547
#14 0x00007ffff79ca14f in _PyEval_EvalCodeWithName (_co=0x7ffff6484810, globals=0x7ffff64e6120, locals=0x7ffff64e6120, args=0x0, 
    argcount=0, kwnames=0x0, kwargs=0x0, kwcount=0, kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0)
    at /usr/src/debug/Python-3.7.3/Python/ceval.c:3930
#15 0x00007ffff79ca347 in PyEval_EvalCodeEx (_co=0x7ffff6484810, globals=0x7ffff64e6120, locals=0x7ffff64e6120, args=0x0, 
    argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at /usr/src/debug/Python-3.7.3/Python/ceval.c:3959
#16 0x00007ffff79b7ff1 in PyEval_EvalCode (co=0x7ffff6484810, globals=0x7ffff64e6120, locals=0x7ffff64e6120)
    at /usr/src/debug/Python-3.7.3/Python/ceval.c:524
#17 0x00007ffff7a0efcf in run_mod (mod=0x6b7790, filename=0x7ffff6514ae8, globals=0x7ffff64e6120, locals=0x7ffff64e6120, 
    flags=0x7fffffffe1dc, arena=0x7ffff7e692d0) at /usr/src/debug/Python-3.7.3/Python/pythonrun.c:1035
#18 0x00007ffff7a0ca53 in PyRun_InteractiveOneObjectEx (fp=0x7ffff6b36f60 <_IO_2_1_stdin_>, filename=0x7ffff6514ae8, 
    flags=0x7fffffffe1dc) at /usr/src/debug/Python-3.7.3/Python/pythonrun.c:256
#19 0x00007ffff7a0c42e in PyRun_InteractiveLoopFlags (fp=0x7ffff6b36f60 <_IO_2_1_stdin_>, filename_str=0x7ffff7ada976 "<stdin>", 
    flags=0x7fffffffe1dc) at /usr/src/debug/Python-3.7.3/Python/pythonrun.c:120
#20 0x00007ffff7a0c27e in PyRun_AnyFileExFlags (fp=0x7ffff6b36f60 <_IO_2_1_stdin_>, filename=0x7ffff7ada976 "<stdin>", closeit=0, 
    flags=0x7fffffffe1dc) at /usr/src/debug/Python-3.7.3/Python/pythonrun.c:78
#21 0x00007ffff7a31e5e in pymain_run_file (fp=0x7ffff6b36f60 <_IO_2_1_stdin_>, filename=0x0, p_cf=0x7fffffffe1dc)
    at /usr/src/debug/Python-3.7.3/Modules/main.c:427
#22 0x00007ffff7a34e51 in pymain_run_filename (pymain=0x7fffffffe230, cf=0x7fffffffe1dc)
    at /usr/src/debug/Python-3.7.3/Modules/main.c:1627
#23 0x00007ffff7a399cf in pymain_run_python (pymain=0x7fffffffe230) at /usr/src/debug/Python-3.7.3/Modules/main.c:2877
#24 0x00007ffff7a39ee2 in pymain_main (pymain=0x7fffffffe230) at /usr/src/debug/Python-3.7.3/Modules/main.c:3038
#25 0x00007ffff7a39f9b in _Py_UnixMain (argc=1, argv=0x7fffffffe398) at /usr/src/debug/Python-3.7.3/Modules/main.c:3073
#26 0x0000000000400772 in main (argc=1, argv=0x7fffffffe398) at /usr/src/debug/Python-3.7.3/Programs/python.c:15
(gdb) p type->tp_name
$1 = 0x7ffff20034c0 "google.protobuf.pyext._message.MessageMeta"
(gdb) p type->tp_doc
$2 = 0x7ffff20034f0 "The metaclass of ProtocolMessages"
(gdb)
History
Date User Action Args
2019-06-27 19:15:08Timothy Lusksetrecipients: + Timothy Lusk
2019-06-27 19:15:08Timothy Lusksetmessageid: <1561662908.45.0.299722199579.issue37434@roundup.psfhosted.org>
2019-06-27 19:15:08Timothy Lusklinkissue37434 messages
2019-06-27 19:15:07Timothy Luskcreate