classification
Title: SIGSEGV in stackdepth_walk
Type: crash Stage:
Components: Interpreter Core Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: anthony shaw, gozdal
Priority: normal Keywords:

Created on 2018-12-19 11:53 by gozdal, last changed 2019-05-06 14:42 by anthony shaw.

Files
File name Uploaded Description Edit
core.pip.8270.1545144472.xz gozdal, 2018-12-19 11:53 Coredump
Messages (3)
msg332129 - (view) Author: Marcin Gozdalik (gozdal) Date: 2018-12-19 11:53
When running

/usr/bin/python /usr/bin/pip install --upgrade "pip < 10"

the interpreter crashed in stackdepth_walk. I've seen this crash multiple times, especially in our custom-compiled CPythons. Here it's 
reproduced with stock Ubuntu Xenial Python. It looks like it happens much more often on AMD Ryzens although it happens also on Intel CPUs.
The Ryzen is otherwise stable.

Sys details:

Python 2.7.12 (default, Nov 12 2018, 14:36:49) 
[GCC 5.4.0 20160609] on linux2

Package python-minimal 2.7.12-1~16.04 from Ubuntu Xenial
msg332130 - (view) Author: Marcin Gozdalik (gozdal) Date: 2018-12-19 11:55
#0  0x00000000004f4af3 in stackdepth_walk (maxdepth=5, depth=3, b=<optimized out>, c=<optimized out>) at ../Python/compile.c:3436
#1  stackdepth_walk (maxdepth=<optimized out>, depth=0, b=<optimized out>, c=0x7fff4f5b84f0) at ../Python/compile.c:3456
#2  stackdepth (c=0x7fff4f5b84f0) at ../Python/compile.c:3486
#3  makecode.isra.19 (c=0x7fff4f5b84f0) at ../Python/compile.c:3854
#4  assemble.lto_priv () at ../Python/compile.c:3960
#5  0x00000000004e31ad in compiler_mod (mod=0x10456d8, c=0x7fff4f5b84f0) at ../Python/compile.c:1212
#6  PyAST_Compile () at ../Python/compile.c:292
#7  0x000000000051e6b0 in Py_CompileStringFlags (
    str=0x11c9e54 "try:\n    from urllib.parse import urljoin\nexcept ImportError:\n    from urlparse import urljoin\n\n\ntry:\n    import cPickle as pickle\nexcept ImportError:\n    import pickle\n\n\n# Handle the case where the r"..., 
    filename=filename@entry=0x7f42be6fb054 "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/compat.py", start=start@entry=257, 
    flags=flags@entry=0x0) at ../Python/pythonrun.c:1433
#8  0x000000000051c924 in compile_source (
    source='try:\n    from urllib.parse import urljoin\nexcept ImportError:\n    from urlparse import urljoin\n\n\ntry:\n    import cPickle as pickle\nexcept ImportError:\n    import pickle\n\n\n# Handle the case where the requests module has been patched to not have\n# urllib3 bundled as part of its source.\ntry:\n    from requests.packages.urllib3.response import HTTPResponse\nexcept ImportError:\n    from urllib3.response import HTTPResponse\n\ntry:\n    from requests.packages.urllib3.util import is_fp_closed\nexcept ImportError:\n    from urllib3.util import is_fp_closed\n', pathname=0x7f42be6fb054 "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/compat.py")
    at ../Modules/zipimport.c:1148
#9  get_code_from_data.isra.2 (
    toc_entry=('/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/compat.py', 8, 216, 548, 7375, 42352, 18741, 1691478637), mtime=<optimized out>, 
    isbytecode=0) at ../Modules/zipimport.c:1222
#10 get_module_code.lto_priv () at ../Modules/zipimport.c:1263
#11 0x0000000000532b72 in zipimporter_load_module.lto_priv () at ../Modules/zipimport.c:320
#12 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#13 0x00000000004cdd9d in call_function_tail (args=('pip._vendor.cachecontrol.compat',), 
    callable=<built-in method load_module of zipimport.zipimporter object at remote 0x7f42be6fd320>) at ../Objects/abstract.c:2578
#14 PyObject_CallMethod () at ../Objects/abstract.c:2653
#15 0x00000000004a4be1 in import_submodule.lto_priv () at ../Python/import.c:2722
#16 0x00000000004a42d9 in load_next (p_buflen=<synthetic pointer>, buf=0x1042cf0 "pip._vendor.cachecontrol.compat", p_name=<synthetic pointer>, altmod=<optimized out>, 
    mod=<optimized out>) at ../Python/import.c:2537
#17 import_module_level.isra.3 (level=0, fromlist=('HTTPResponse', 'pickle'), globals=<optimized out>, name=<optimized out>) at ../Python/import.c:2246
#18 PyImport_ImportModuleLevel () at ../Python/import.c:2310
#19 0x00000000004a5ae4 in builtin___import__ () at ../Python/bltinmodule.c:49
#20 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#21 0x00000000004c5ef0 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4219
#22 0x00000000004bec4b in PyEval_EvalFrameEx () at ../Python/ceval.c:2622
#23 0x00000000004b9b66 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#24 0x00000000004b9856 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:669
#25 0x00000000004b978f in PyImport_ExecCodeModuleEx () at ../Python/import.c:731
#26 0x0000000000532bd0 in zipimporter_load_module.lto_priv () at ../Modules/zipimport.c:360
#27 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#28 0x00000000004cdd9d in call_function_tail (args=('pip._vendor.cachecontrol.serialize',), 
    callable=<built-in method load_module of zipimport.zipimporter object at remote 0x7f42be6fd320>) at ../Objects/abstract.c:2578
#29 PyObject_CallMethod () at ../Objects/abstract.c:2653
#30 0x00000000004a4be1 in import_submodule.lto_priv () at ../Python/import.c:2722
#31 0x00000000004a42d9 in load_next (p_buflen=<synthetic pointer>, buf=0x1040cd0 "pip._vendor.cachecontrol.serialize", p_name=<synthetic pointer>, altmod=<optimized out>, 
    mod=<optimized out>) at ../Python/import.c:2537
#32 import_module_level.isra.3 (level=0, fromlist=('Serializer',), globals=<optimized out>, name=<optimized out>) at ../Python/import.c:2246
#33 PyImport_ImportModuleLevel () at ../Python/import.c:2310
#34 0x00000000004a5ae4 in builtin___import__ () at ../Python/bltinmodule.c:49
#35 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#36 0x00000000004c5ef0 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4219
#37 0x00000000004bec4b in PyEval_EvalFrameEx () at ../Python/ceval.c:2622
#38 0x00000000004b9b66 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#39 0x00000000004b9856 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:669
#40 0x00000000004b978f in PyImport_ExecCodeModuleEx () at ../Python/import.c:731
#41 0x0000000000532bd0 in zipimporter_load_module.lto_priv () at ../Modules/zipimport.c:360
#42 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#43 0x00000000004cdd9d in call_function_tail (args=('pip._vendor.cachecontrol.controller',), 
    callable=<built-in method load_module of zipimport.zipimporter object at remote 0x7f42be6fd320>) at ../Objects/abstract.c:2578
#44 PyObject_CallMethod () at ../Objects/abstract.c:2653
#45 0x00000000004a4be1 in import_submodule.lto_priv () at ../Python/import.c:2722
#46 0x00000000004a42d9 in load_next (p_buflen=<synthetic pointer>, buf=0x105edb0 "pip._vendor.cachecontrol.controller", p_name=<synthetic pointer>, altmod=<optimized out>, 
    mod=<optimized out>) at ../Python/import.c:2537
#47 import_module_level.isra.3 (level=0, fromlist=('CacheController',), globals=<optimized out>, name=<optimized out>) at ../Python/import.c:2246
#48 PyImport_ImportModuleLevel () at ../Python/import.c:2310
#49 0x00000000004a5ae4 in builtin___import__ () at ../Python/bltinmodule.c:49
#50 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#51 0x00000000004c5ef0 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4219
#52 0x00000000004bec4b in PyEval_EvalFrameEx () at ../Python/ceval.c:2622
#53 0x00000000004b9b66 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#54 0x00000000004b9856 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:669
#55 0x00000000004b978f in PyImport_ExecCodeModuleEx () at ../Python/import.c:731
#56 0x0000000000532bd0 in zipimporter_load_module.lto_priv () at ../Modules/zipimport.c:360
#57 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#58 0x00000000004cdd9d in call_function_tail (args=('pip._vendor.cachecontrol.caches.file_cache',), 
    callable=<built-in method load_module of zipimport.zipimporter object at remote 0x7f42bce7a908>) at ../Objects/abstract.c:2578
#59 PyObject_CallMethod () at ../Objects/abstract.c:2653
#60 0x00000000004a4be1 in import_submodule.lto_priv () at ../Python/import.c:2722
#61 0x00000000004a42d9 in load_next (p_buflen=<synthetic pointer>, buf=0x11addf0 "pip._vendor.cachecontrol.caches.file_cache", p_name=<synthetic pointer>, 
    altmod=<optimized out>, mod=<optimized out>) at ../Python/import.c:2537
#62 import_module_level.isra.3 (level=0, fromlist=('FileCache',), globals=<optimized out>, name=<optimized out>) at ../Python/import.c:2246
#63 PyImport_ImportModuleLevel () at ../Python/import.c:2310
#64 0x00000000004a5ae4 in builtin___import__ () at ../Python/bltinmodule.c:49
#65 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#66 0x00000000004c5ef0 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4219
#67 0x00000000004bec4b in PyEval_EvalFrameEx () at ../Python/ceval.c:2622
#68 0x00000000004b9b66 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#69 0x00000000004b9856 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:669
#70 0x00000000004b978f in PyImport_ExecCodeModuleEx () at ../Python/import.c:731
#71 0x0000000000532bd0 in zipimporter_load_module.lto_priv () at ../Modules/zipimport.c:360
#72 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#73 0x00000000004cdd9d in call_function_tail (args=('pip._vendor.cachecontrol.caches',), 
    callable=<built-in method load_module of zipimport.zipimporter object at remote 0x7f42be6fd320>) at ../Objects/abstract.c:2578
#74 PyObject_CallMethod () at ../Objects/abstract.c:2653
#75 0x00000000004a4be1 in import_submodule.lto_priv () at ../Python/import.c:2722
#76 0x00000000004a4667 in load_next (p_buflen=<synthetic pointer>, buf=<optimized out>, p_name=<synthetic pointer>, altmod=<module at remote 0x7f42be6eebe8>, 
    mod=<module at remote 0x7f42be6eebe8>) at ../Python/import.c:2537
#77 import_module_level.isra.3 (level=0, fromlist=('FileCache',), globals=<optimized out>, name=<optimized out>) at ../Python/import.c:2254
#78 PyImport_ImportModuleLevel () at ../Python/import.c:2310
#79 0x00000000004a5ae4 in builtin___import__ () at ../Python/bltinmodule.c:49
#80 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#81 0x00000000004c5ef0 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4219
#82 0x00000000004bec4b in PyEval_EvalFrameEx () at ../Python/ceval.c:2622
#83 0x00000000004b9b66 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#84 0x00000000004b9856 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:669
#85 0x00000000004b978f in PyImport_ExecCodeModuleEx () at ../Python/import.c:731
#86 0x00000000004b2bc6 in load_source_module.lto_priv () at ../Python/import.c:1121
#87 0x00000000004a4be1 in import_submodule.lto_priv () at ../Python/import.c:2722
#88 0x00000000004a4667 in load_next (p_buflen=<synthetic pointer>, buf=<optimized out>, p_name=<synthetic pointer>, altmod=<module at remote 0x7f42c0253ad0>, 
    mod=<module at remote 0x7f42c0253ad0>) at ../Python/import.c:2537
#89 import_module_level.isra.3 (level=0, fromlist=('path_to_url',), globals=<optimized out>, name=<optimized out>) at ../Python/import.c:2254
#90 PyImport_ImportModuleLevel () at ../Python/import.c:2310
#91 0x00000000004a5ae4 in builtin___import__ () at ../Python/bltinmodule.c:49
#92 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#93 0x00000000004c5ef0 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4219
#94 0x00000000004bec4b in PyEval_EvalFrameEx () at ../Python/ceval.c:2622
#95 0x00000000004b9b66 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#96 0x00000000004b9856 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:669
#97 0x00000000004b978f in PyImport_ExecCodeModuleEx () at ../Python/import.c:731
#98 0x00000000004b2bc6 in load_source_module.lto_priv () at ../Python/import.c:1121
#99 0x00000000004a4be1 in import_submodule.lto_priv () at ../Python/import.c:2722
#100 0x00000000004a80e5 in ensure_fromlist.lto_priv () at ../Python/import.c:2628
#101 0x00000000004a4028 in import_module_level.isra.3 (level=0, fromlist=('git', 'mercurial', 'subversion', 'bazaar'), globals=<optimized out>, name=<optimized out>)
    at ../Python/import.c:2291
#102 PyImport_ImportModuleLevel () at ../Python/import.c:2310
#103 0x00000000004a5ae4 in builtin___import__ () at ../Python/bltinmodule.c:49
#104 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#105 0x00000000004c5ef0 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4219
#106 0x00000000004bec4b in PyEval_EvalFrameEx () at ../Python/ceval.c:2622
#107 0x00000000004b9b66 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#108 0x00000000004b9856 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:669
#109 0x00000000004b978f in PyImport_ExecCodeModuleEx () at ../Python/import.c:731
#110 0x00000000004b2bc6 in load_source_module.lto_priv () at ../Python/import.c:1121
#111 0x00000000004b40ec in load_package.lto_priv () at ../Python/import.c:1188
#112 0x00000000004a4be1 in import_submodule.lto_priv () at ../Python/import.c:2722
#113 0x00000000004a3f74 in load_next (p_buflen=<synthetic pointer>, buf=0xcb6610 "pip", p_name=<synthetic pointer>, altmod=<optimized out>, mod=<optimized out>)
    at ../Python/import.c:2537
#114 import_module_level.isra.3 (level=-1, fromlist=('main',), globals=<optimized out>, name=0x0) at ../Python/import.c:2246
#115 PyImport_ImportModuleLevel () at ../Python/import.c:2310
#116 0x00000000004a5ae4 in builtin___import__ () at ../Python/bltinmodule.c:49
#117 0x00000000004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#118 0x00000000004c5ef0 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4219
#119 0x00000000004bec4b in PyEval_EvalFrameEx () at ../Python/ceval.c:2622
#120 0x00000000004b9b66 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#121 0x00000000004eb69f in PyEval_EvalCode (
    locals={'__builtins__': <module at remote 0x7f42c0358b08>, '__file__': '/usr/bin/pip', '__package__': None, 'sys': <module at remote 0x7f42c0358bb0>, '__name__': '__main__', '__doc__': None}, 
    globals={'__builtins__': <module at remote 0x7f42c0358b08>, '__file__': '/usr/bin/pip', '__package__': None, 'sys': <module at remote 0x7f42c0358bb0>, '__name__': '__main__', '__doc__': None}, co=0x7f42c028d8b0) at ../Python/ceval.c:669
#122 run_mod.lto_priv () at ../Python/pythonrun.c:1376
#123 0x00000000004e58f2 in PyRun_FileExFlags () at ../Python/pythonrun.c:1362
#124 0x00000000004e41a6 in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:948
#125 0x00000000004938ce in Py_Main () at ../Modules/main.c:640
#126 0x00007f42bfbb7830 in __libc_start_main (main=0x493370 <main>, argc=5, argv=0x7fff4f5bc368, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7fff4f5bc358) at ../csu/libc-start.c:291
#127 0x0000000000493299 in _start ()
msg341511 - (view) Author: anthony shaw (anthony shaw) Date: 2019-05-06 14:42
stackdepth_walk no longer exists in Python 3, this is a 2.7 specific issue.

opcode_stack_effect in compile.c will have the expected stack effect. If there is a mismatch between the Opcodes compiled with the distribution and the ones in the compile.c opcode_stack_effect, it can cause a crash.

Ensure that `make regen-all` is run before compiling with a clean build to avoid this.
History
Date User Action Args
2019-05-06 14:42:26anthony shawsetnosy: + anthony shaw

messages: + msg341511
versions: - Python 3.6
2018-12-19 11:55:39gozdalsetmessages: + msg332130
2018-12-19 11:53:03gozdalcreate