python2.7 throws bus error when issuing `help("modules")'

Ryan Schmidt ryandesign at macports.org
Mon Aug 24 09:58:42 UTC 2020



On Aug 24, 2020, at 03:34, joerg van den hoff wrote:

> On 23.08.20 21:45, Joshua Root wrote:
>> joerg van den hoff wrote:
>>> seen with current macports and
>>> 
>>> Python 2.7.18 (default, Apr 22 2020, 05:03:29)
>>> [GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.32.29)] on darwin
>>> 
>>> I get a reproducible bus error when trying to get a list of known modules
>>> 
>>> with `help("modules").
>>> 
>>> /usr/bin/python (which is 2.7.16) does not do this and lists the modules just fine. any ideas how to
>>> track this down?
>> It may be a problem with one of your installed modules. Find the crash
>> log in ~/Library/Logs/DiagnosticReports or possibly
>> /Library/Logs/DiagnosticReports.
> 
> thanks for this suggestion. I have had a look and cannot make sufficient sense of it. here is the leading section with the traceback:
> 
> ==========cut=================
> Process:               Python [39583]
> Path: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
> Identifier:            Python
> Version:               2.7.18 (2.7.18)
> Code Type:             X86-64 (Native)
> Parent Process:        mksh [39567]
> Responsible:           launchd_startx [536]
> User ID:               501
> 
> Date/Time:             2020-08-23 15:42:58.343 +0200
> OS Version:            Mac OS X 10.15.3 (19D76)
> Report Version:        12
> Bridge OS Version:     4.2 (17P3050)
> Anonymous UUID:        796719FD-E55D-61E2-97C4-8064BB1374F8
> 
> Sleep/Wake UUID:       2DF1A4D2-1168-4425-B0FD-8A2210C1F5BE
> 
> Time Awake Since Boot: 860000 seconds
> Time Since Wake:       1000 seconds
> 
> System Integrity Protection: enabled
> 
> Crashed Thread:        0  Dispatch queue: com.apple.main-thread
> 
> Exception Type:        EXC_BAD_ACCESS (SIGBUS)
> Exception Codes:       KERN_PROTECTION_FAILURE at 0x0000000105ec4b1e
> Exception Note:        EXC_CORPSE_NOTIFY
> 
> Termination Signal:    Bus error: 10
> Termination Reason:    Namespace SIGNAL, Code 0xa
> Terminating Process:   exc handler [39583]
> 
> VM Regions Near 0x105ec4b1e:
>    __TEXT                 0000000105e68000-0000000105ebc000 [  336K] r-x/rwx SM=COW /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/objc/_objc.so
> --> __DATA_CONST           0000000105ebc000-0000000105ec7000 [   44K] r--/rwx SM=COW /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/objc/_objc.so
>    __DATA                 0000000105ec7000-0000000105ed5000 [   56K] rw-/rwx SM=COW /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/objc/_objc.so
> 
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   _objc.so                      	0x0000000105e91703 setup_descr + 451
> 1   _objc.so                      	0x0000000105e903c9 process_metadata_dict + 105
> 2   _objc.so                      	0x0000000105e8fdd3 PyObjCMethodSignature_WithMetaData + 51
> 3   _objc.so                      	0x0000000105e919b6 setup_descr + 1142
> 4   _objc.so                      	0x0000000105e90506 process_metadata_dict + 422
> 5   _objc.so                      	0x0000000105e8fc83 PyObjC_registerMetaData + 451
> 6   _objc.so                      	0x0000000105e9479e registerMetaData + 78
> 7   org.python.python             	0x00000001046d540c PyEval_EvalFrameEx + 26124
> 8   org.python.python             	0x00000001046ceb64 PyEval_EvalCodeEx + 2132
> 9   org.python.python             	0x00000001046ce302 PyEval_EvalCode + 34
> 10  org.python.python             	0x00000001046f0726 PyImport_ExecCodeModuleEx + 230
> 11  org.python.python             	0x00000001046f3a7f load_source_module + 975
> 12  org.python.python             	0x00000001046f354d import_submodule + 285
> 13  org.python.python             	0x00000001046f2f9e load_next + 270
> 14  org.python.python             	0x00000001046f1e3b PyImport_ImportModuleLevel + 875
> 15  org.python.python             	0x00000001046c9629 builtin___import__ + 137
> 16  org.python.python             	0x0000000104622ff1 PyObject_Call + 97
> 17  org.python.python             	0x00000001046d375b PyEval_EvalFrameEx + 18779
> 18  org.python.python             	0x00000001046ceb64 PyEval_EvalCodeEx + 2132
> 19  org.python.python             	0x00000001046ce302 PyEval_EvalCode + 34
> 20  org.python.python             	0x00000001046f0726 PyImport_ExecCodeModuleEx + 230
> 21  org.python.python             	0x00000001046f3a7f load_source_module + 975
> 22  org.python.python             	0x00000001046f3df1 load_package + 321
> 23  org.python.python             	0x00000001046f354d import_submodule + 285
> 24  org.python.python             	0x00000001046f2feb load_next + 347
> 25  org.python.python             	0x00000001046f1dc5 PyImport_ImportModuleLevel + 757
> 26  org.python.python             	0x00000001046c9629 builtin___import__ + 137
> 27  org.python.python             	0x0000000104622ff1 PyObject_Call + 97
> 28  org.python.python             	0x00000001046d375b PyEval_EvalFrameEx + 18779
> 29  org.python.python             	0x00000001046ceb64 PyEval_EvalCodeEx + 2132
> 30  org.python.python             	0x00000001046ce302 PyEval_EvalCode + 34
> 31  org.python.python             	0x00000001046f0726 PyImport_ExecCodeModuleEx + 230
> 32  org.python.python             	0x00000001046f3a7f load_source_module + 975
> 33  org.python.python             	0x00000001046f3df1 load_package + 321
> 34  org.python.python             	0x00000001046f354d import_submodule + 285
> 35  org.python.python             	0x00000001046f2f9e load_next + 270
> 36  org.python.python             	0x00000001046f1dc5 PyImport_ImportModuleLevel + 757
> 37  org.python.python             	0x00000001046c9629 builtin___import__ + 137
> 38  org.python.python             	0x00000001046d540c PyEval_EvalFrameEx + 26124
> 39  org.python.python             	0x0000000104641d64 gen_send_ex + 180
> 40  org.python.python             	0x00000001046d4589 PyEval_EvalFrameEx + 22409
> 41  org.python.python             	0x00000001046ceb64 PyEval_EvalCodeEx + 2132
> 42  org.python.python             	0x00000001046db9da fast_function + 106
> 43  org.python.python             	0x00000001046d4bcf PyEval_EvalFrameEx + 24015
> 44  org.python.python             	0x00000001046ceb64 PyEval_EvalCodeEx + 2132
> 45  org.python.python             	0x00000001046db9da fast_function + 106
> 46  org.python.python             	0x00000001046d4bcf PyEval_EvalFrameEx + 24015
> 47  org.python.python             	0x00000001046dbac1 fast_function + 337
> 48  org.python.python             	0x00000001046d4bcf PyEval_EvalFrameEx + 24015
> 49  org.python.python             	0x00000001046dbac1 fast_function + 337
> 50  org.python.python             	0x00000001046d4bcf PyEval_EvalFrameEx + 24015
> 51  org.python.python             	0x00000001046ceb64 PyEval_EvalCodeEx + 2132
> 52  org.python.python             	0x000000010464d734 function_call + 340
> 53  org.python.python             	0x0000000104622ff1 PyObject_Call + 97
> 54  org.python.python             	0x0000000104632f24 instancemethod_call + 180
> 55  org.python.python             	0x0000000104622ff1 PyObject_Call + 97
> 56  org.python.python             	0x0000000104631ffe instance_call + 110
> 57  org.python.python             	0x0000000104622ff1 PyObject_Call + 97
> 58  org.python.python             	0x00000001046d5dd7 PyEval_EvalFrameEx + 28631
> 59  org.python.python             	0x00000001046ceb64 PyEval_EvalCodeEx + 2132
> 60  org.python.python             	0x000000010464d734 function_call + 340
> 61  org.python.python             	0x0000000104622ff1 PyObject_Call + 97
> 62  org.python.python             	0x0000000104632f24 instancemethod_call + 180
> 63  org.python.python             	0x0000000104622ff1 PyObject_Call + 97
> 64  org.python.python             	0x0000000104688438 slot_tp_call + 168
> 65  org.python.python             	0x0000000104622ff1 PyObject_Call + 97
> 66  org.python.python             	0x00000001046d512c PyEval_EvalFrameEx + 25388
> 67  org.python.python             	0x00000001046ceb64 PyEval_EvalCodeEx + 2132
> 68  org.python.python             	0x00000001046ce302 PyEval_EvalCode + 34
> 69  org.python.python             	0x00000001046feefb PyRun_InteractiveOneFlags + 443
> 70  org.python.python             	0x00000001046fe91e PyRun_InteractiveLoopFlags + 158
> 71  org.python.python             	0x00000001046fe7b0 PyRun_AnyFileExFlags + 64
> 72  org.python.python             	0x00000001047169a4 Py_Main + 3252
> 73  libdyld.dylib                 	0x00007fff72e457fd start + 1
> 
> Thread 1:
> 0   libsystem_pthread.dylib       	0x00007fff73045818 start_wqthread + 0
> 
> Thread 2:
> 0   libsystem_pthread.dylib       	0x00007fff73045818 start_wqthread + 0
> 
> Thread 0 crashed with X86 Thread State (64-bit):
>  rax: 0x0000000000000408  rbx: 0x0000000105f403b0  rcx: 0x0000000000000400  rdx: 0x0000000104772600
>  rdi: 0x0000000105a7a0f0  rsi: 0x0000000105a7a0f0  rbp: 0x00007ffeeb5f19e0  rsp: 0x00007ffeeb5f1960
>   r8: 0x0000000105f403e8   r9: 0x000000000000000e  r10: 0x0000000000000010  r11: 0xffffffffffbc64d0
>  r12: 0x0000000105f403b0  r13: 0x00000000fffffffe  r14: 0x0000000000000000  r15: 0x0000000105ec4b00
>  rip: 0x0000000105e91703  rfl: 0x0000000000010202  cr2: 0x0000000105ec4b1e
> 
> Logical CPU:     2
> Error Code:      0x00000007 (invalid protections for user data read)
> Trap Number:     14
> ==========cut=================
> 
> do you see the problem? I don't :|

Fixed!

https://github.com/macports/macports-ports/commit/d28bf24c7f754c2b49ff36eb57eb6aec4e687e5f

Wait an hour, then you can "sudo port selfupdate" and "sudo port upgrade outdated" to receive the fix.


The fact that it crashed in setup_descr tipped me off that it was the same problem we fixed in py36-pyobjc / py37-pyobjc / py38-pyobjc awhile ago:

https://trac.macports.org/ticket/59781#comment:24

https://github.com/macports/macports-ports/commit/d16123838f5fd089fbab17d93e9719f1c57ea126

(PyObjC was writing to a memory location that had been declared read-only; macOS versions prior to Catalina allowed this but Catalina forces a crash so that the developer is forced to fix this.)

We hadn't brought this fix back to py27-pyobjc / py35-pyobjc but now we have.





More information about the macports-users mailing list