On Mon, Oct 30, 2017 at 02:02:25PM +0100, M.-A. Lemburg wrote: > PS: Please CC me on replies as I don't regularly read c.l.p anymore.
Sure. > >> Could you check whether you have similar import errors with > >> other modules that have C extensions ? E.g. lxml. > >> > >> What you're seeing appears to be a compilation problem > >> with Python 2.7.14 on Debian. The executable doesn't appear > >> to export its symbols to the .so files, or only some of them. > > > > Let's see: > > ... using -dbg packages for everything, the imports work ... > > Ah, so you were mixing debug packages with non-debug ones. This > explains the import errors. I am not sure I do. I installed normal and -dbg packages for modules with c extensions, say psycopg2: python-psycopg2: Installiert: 2.7.3-1 Installationskandidat: 2.7.3-1 Versionstabelle: *** 2.7.3-1 990 990 http://httpredir.debian.org/debian buster/main i386 Packages 500 http://httpredir.debian.org/debian unstable/main i386 Packages 100 /var/lib/dpkg/status 2.6.2-1 500 500 http://httpredir.debian.org/debian stretch/main i386 Packages python-psycopg2-dbg: Installiert: 2.7.3-1 Installationskandidat: 2.7.3-1 Versionstabelle: *** 2.7.3-1 990 990 http://httpredir.debian.org/debian buster/main i386 Packages 500 http://httpredir.debian.org/debian unstable/main i386 Packages 100 /var/lib/dpkg/status 2.6.2-1 500 500 http://httpredir.debian.org/debian stretch/main i386 Packages Now, when running either python2.7 or python2.7-dbg, which are installed alongside python2.7-dbg: Installiert: 2.7.14-2 Installationskandidat: 2.7.14-2 Versionstabelle: *** 2.7.14-2 990 990 http://httpredir.debian.org/debian buster/main i386 Packages 500 http://httpredir.debian.org/debian unstable/main i386 Packages 100 /var/lib/dpkg/status 2.7.13-2 500 500 http://httpredir.debian.org/debian stretch/main i386 Packages python2.7: Installiert: 2.7.14-2 Installationskandidat: 2.7.14-2 Versionstabelle: *** 2.7.14-2 990 990 http://httpredir.debian.org/debian buster/main i386 Packages 500 http://httpredir.debian.org/debian unstable/main i386 Packages 100 /var/lib/dpkg/status 2.7.13-2 500 500 http://httpredir.debian.org/debian stretch/main i386 Packages the Debian version does (should ?) take care to import either the -dbg or the normal version of modules. It seems it so does because when I got both module versions installed I don't get any import errors. So I don't think I am mixing, at least not to my knowledge. (But I still get the SIGABORT on shutdown regardless.) > Do you just see the SIGABRT when running the debug versions or > also with the production versions (memory management works differently > in Python debug mode) ? Either version fails. Why haven't I tried running this under python3 ? Because the whole shebang is part of a wxPython application (GNUmed) and there are no Debian packages for wxPython/wxPhoenix on py3 as far as I know. > BTW: It would help if you'd post the stack trace with symbols. > The one you posted in one of your earlier emails only includes > addresses. I'd gladly comply if I knew how. This is what apt says about python2.7-dbg: Package: python2.7-dbg Version: 2.7.14-2 Description-en: Debug Build of the Python Interpreter (version 2.7) The package holds two things: . - A Python interpreter configured with --pydebug. Dynamically loaded modules are searched as <foo>_d.so first. Third party extensions need a separate build to be used by this interpreter. - Debug information for standard python interpreter and extensions. So from that I conferred it does contain symbols. I am getting a fresh run under gdb with python2.7-dbg. Maybe you can point out where you'd have expected to see symbols and help me figure out which -dbg package is missing on this Debian system: [...] ==> verifying target database schema ... ==> checking migrated data for plausibility ... Done bootstrapping GNUmed database: We very likely succeeded. log: /home/ncq/Projekte/gm-git/gnumed/gnumed/server/bootstrap/bootstrap-latest.log Debug memory block at address p=0x6aab7c: API '' 0 bytes originally requested The 3 pad bytes at p-3 are not all FORBIDDENBYTE (0xfb): at p-3: 0x33 *** OUCH at p-2: 0x47 *** OUCH at p-1: 0x00 *** OUCH Because memory is corrupted at the start, the count of bytes requested may be bogus, and checking the trailing pad bytes may segfault. The 4 pad bytes at tail=0x6aab7c are not all FORBIDDENBYTE (0xfb): at tail+0: 0x00 *** OUCH at tail+1: 0x00 *** OUCH at tail+2: 0x00 *** OUCH at tail+3: 0x00 *** OUCH The block was made by call #0 to debug malloc/realloc. Fatal Python error: bad ID: Allocated using API '', verified using API 'o' Program received signal SIGABRT, Aborted. 0xb7fd9ce9 in __kernel_vsyscall () (gdb) bt #0 0xb7fd9ce9 in __kernel_vsyscall () #1 0xb7d70dd0 in __libc_signal_restore_set (set=0xbfffed40) at ../sysdeps/unix/sysv/linux/nptl-signals.h:79 #2 __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:48 #3 0xb7d72297 in __GI_abort () at abort.c:89 #4 0x0055fb74 in Py_FatalError (msg=0xbfffefec "bad ID: Allocated using API '\037', verified using API 'o'") at ../Python/pythonrun.c:1700 #5 0x00499adb in _PyObject_DebugCheckAddressApi (api=111 'o', p=0x6aab7c <_Py_ZeroStruct>) at ../Objects/obmalloc.c:1640 #6 0x004997a5 in _PyObject_DebugFreeApi (api=111 'o', p=0x6aab7c <_Py_ZeroStruct>) at ../Objects/obmalloc.c:1527 #7 0x0049964f in _PyObject_DebugFree (p=0x6aab7c <_Py_ZeroStruct>) at ../Objects/obmalloc.c:1471 #8 0x00471043 in int_dealloc (v=0x6aab7c <_Py_ZeroStruct>) at ../Objects/intobject.c:139 #9 0x00497bee in _Py_Dealloc (op=False) at ../Objects/object.c:2262 #10 0x00489bad in dict_dealloc (mp=0xb79f10d4) at ../Objects/dictobject.c:1085 Python Exception <class 'UnicodeDecodeError'> 'utf-8' codec can't decode byte 0xb7 in position 3: invalid start byte: #11 0x00497bee in _Py_Dealloc (op=) at ../Objects/object.c:2262 Python Exception <class 'UnicodeDecodeError'> 'utf-8' codec can't decode byte 0xb7 in position 3: invalid start byte: #12 0x004b9ab7 in subtype_dealloc (self=) at ../Objects/typeobject.c:1035 Python Exception <class 'UnicodeDecodeError'> 'utf-8' codec can't decode byte 0xb7 in position 3: invalid start byte: #13 0x00497bee in _Py_Dealloc (op=) at ../Objects/object.c:2262 #14 0x0044dc7a in instancemethod_dealloc (im=0xb79e9034) at ../Objects/classobject.c:2388 #15 0x00497bee in _Py_Dealloc (op=<instancemethod at remote 0xb79e9034>) at ../Objects/object.c:2262 #16 0x004885d7 in insertdict_by_entry (mp=0xb7891214, key='_shutdown', hash=598970216, ep=0x88e1ec, value=None) at ../Objects/dictobject.c:519 #17 0x00488857 in insertdict (mp=0xb7891214, key='_shutdown', hash=598970216, value=None) at ../Objects/dictobject.c:556 #18 0x0048910f in dict_set_item_by_hash_or_entry ( op={'current_thread': <function at remote 0xb79f23a4>, '_BoundedSemaphore': None, 'currentThread': <function at remote 0xb79f23a4>, '_Timer': None, '_format_exc': None, 'Semaphore': <function at remote 0xb79ec174>, '_deque': None, 'activeCount': <function at remote 0xb79f24e4>, '_profile_hook': None, '_sleep': None, '_trace_hook': None, 'ThreadError': <type at remote 0xb7850414>, '_enumerate': None, '_start_new_thread': None, 'BoundedSemaphore': <function at remote 0xb79ec4e4>, '_shutdown': None, '__all__': ['activeCount', 'active_count', 'Condition', 'currentThread', 'current_thread', 'enumerate', 'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Timer', 'setprofile', 'settrace', 'local', 'stack_size'], '_Event': <type at remote 0xb79ee224>, 'active_count': <function at remote 0xb79f24e4>, '__package__': None, '_Condition': <type at remote 0xb7850bd4>, '_RLock': <type at remote 0xb78509e4>, '_test': <function at remote 0xb79f2624>, 'local': <type at remote 0 x6fd420>, '__doc__': "Thread modul...(truncated), key='_shutdown', hash=598970216, ep=0x0, value=None) at ../Objects/dictobject.c:795 #19 0x00489285 in PyDict_SetItem ( op={'current_thread': <function at remote 0xb79f23a4>, '_BoundedSemaphore': None, 'currentThread': <function at remote 0xb79f23a4>, '_Timer': None, '_format_exc': None, 'Semaphore': <function at remote 0xb79ec174>, '_deque': None, 'activeCount': <function at remote 0xb79f24e4>, '_profile_hook': None, '_sleep': None, '_trace_hook': None, 'ThreadError': <type at remote 0xb7850414>, '_enumerate': None, '_start_new_thread': None, 'BoundedSemaphore': <function at remote 0xb79ec4e4>, '_shutdown': None, '__all__': ['activeCount', 'active_count', 'Condition', 'currentThread', 'current_thread', 'enumerate', 'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Timer', 'setprofile', 'settrace', 'local', 'stack_size'], '_Event': <type at remote 0xb79ee224>, 'active_count': <function at remote 0xb79f24e4>, '__package__': None, '_Condition': <type at remote 0xb7850bd4>, '_RLock': <type at remote 0xb78509e4>, '_test': <function at remote 0xb79f2624>, 'local': <type at remote 0 x6fd420>, '__doc__': "Thread modul...(truncated), key='_shutdown', value=None) at ../Objects/dictobject.c:848 #20 0x00492758 in _PyModule_Clear (m=<module at remote 0xb78a1154>) at ../Objects/moduleobject.c:125 #21 0x0054a33b in PyImport_Cleanup () at ../Python/import.c:530 #22 0x0055c53c in Py_Finalize () at ../Python/pythonrun.c:458 #23 0x0055fe9c in Py_Exit (sts=0) at ../Python/pythonrun.c:1783 #24 0x0055e0fc in handle_system_exit () at ../Python/pythonrun.c:1151 #25 0x0055e152 in PyErr_PrintEx (set_sys_last_vars=1) at ../Python/pythonrun.c:1161 #26 0x0055dd5b in PyErr_Print () at ../Python/pythonrun.c:1064 #27 0x0055d61f in PyRun_SimpleFileExFlags (fp=0x7ee010, filename=0xbffff7e6 "./bootstrap_gm_db_system.py", closeit=1, flags=0xbffff4f4) at ../Python/pythonrun.c:952 #28 0x0055cc4e in PyRun_AnyFileExFlags (fp=0x7ee010, filename=0xbffff7e6 "./bootstrap_gm_db_system.py", closeit=1, flags=0xbffff4f4) at ../Python/pythonrun.c:752 #29 0x00577cb0 in Py_Main (argc=5, argv=0xbffff684) at ../Modules/main.c:645 #30 0x004259c8 in main (argc=5, argv=0xbffff684) at ../Modules/python.c:20 (gdb) q A debugging session is active. Inferior 1 [process 12740] will be killed. Quit anyway? (y or n) y Does that help ? Thanks, Karsten -- GPG key ID E4071346 @ eu.pool.sks-keyservers.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 -- https://mail.python.org/mailman/listinfo/python-list