[issue18356] help(numpy) causes segfault on exit
New submission from Michelle Arzul: As far as we could tell this bug is only consistently reproducible on Ubuntu 13.04. A line in pydoc.py causes a segfault when help(numpy) (no other libraries that I know of) exits. The offending method is pipepager(). For a full trackdown and workaround of the problem see http://stackoverflow.com/questions/17344974/python-helpnumpy-causes-segfault... ---------- assignee: docs@python components: Documentation messages: 192276 nosy: Leeward, docs@python priority: normal severity: normal status: open title: help(numpy) causes segfault on exit type: crash versions: Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18356> _______________________________________
Christian Heimes added the comment: Please provide more information about your setup. Not everybody has access to a Ubuntu 13.04 box * exact Python version * NumPy version * platform (X86, X86_64, ARM) * Kernel, libc and compiler version are useful, too * terminal application * environment variables (output of ``export``, you may want to strip sensible values like DBus address). Especially TERM, PAGER and all LESS* variables are of interest. ---------- components: +Library (Lib) -Documentation nosy: +christian.heimes versions: +3rd party _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18356> _______________________________________
Michelle Arzul added the comment: I'm no expert, I just found the bug... but I'll try my best. * exact Python version: 2.7.4 (GCC 4.7.3) * NumPy version: 1.7.1 * platform (X86, X86_64, ARM): i686 * Kernel: Linux 3.8.0-25-generic #37-Ubuntu SMP Thu Jun 6 20:47:30 UTC 2013 i686 i686 i686 GNU/Linux * libc: ldd (Ubuntu EGLIBC 2.17-0ubuntu5) 2.17 * compiler: gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) * terminal application: not sure what you mean * environment variables: TERM="xterm" (PAGER is not present) LESSCLOSE="/usr/bin/lesspipe %s %s" LESSOPEN="| /usr/bin/lesspipe %s" If you need anything else please let me know. ---------- components: +Documentation -Library (Lib) versions: -3rd party _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18356> _______________________________________
R. David Murray added the comment: pydoc doesn't do anything special other than import the module. Well, there's some special code in linecache for getting docstrings from C modules, I think, so that could be something to check. Does Ubuntu have local patches to numpy? ---------- nosy: +r.david.murray _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18356> _______________________________________
Michelle Arzul added the comment: Apparently it only occurs with the Ubuntu packaged versions of Python and numpy. Somebody who was able to reproduce my problem had it with python-2.7.4-0ubuntu1-amd64 and python-numpy-1:1.7.1-1ubuntu1-amd64 which exhibited the same behaviour. Apparently python-dbg and python-numpy-dbg do not reproduce the error. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18356> _______________________________________
Changes by STINNER Victor <victor.stinner@gmail.com>: ---------- nosy: +haypo _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18356> _______________________________________
STINNER Victor added the comment:
For a full trackdown and workaround of the problem see http://stackoverflow.com/questions/17344974/python-helpnumpy-causes-segfault...
The gdb trace is not interesting because it stopped at SIGPIPE, which is not an error. Please rerun your program in gdb and ignore SIGPIPE (type "handle SIGPIPE noprint nostop") or continue on PIPE (type "cont"). Then when you get the crash, please copy/paste the gdb traceback here. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18356> _______________________________________
Michelle Arzul added the comment: This is what I get from gdb: marzul@Leeward:~$ gdb --args python test.py GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu Copyright (C) 2013 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 "i686-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/bin/python2.7...(no debugging symbols found)...done. (gdb) run Starting program: /usr/bin/python2.7 test.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". Program received signal SIGPIPE, Broken pipe. 0xb7fdd424 in __kernel_vsyscall () (gdb) cont Continuing. Program received signal SIGPIPE, Broken pipe. 0xb7fdd424 in __kernel_vsyscall () (gdb) cont Continuing. Program received signal SIGSEGV, Segmentation fault. 0xb7e518fc in ?? () from /lib/i386-linux-gnu/libc.so.6 (gdb) cont Continuing. Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists. (gdb) run Starting program: /usr/bin/python2.7 test.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". Program received signal SIGPIPE, Broken pipe. 0xb7fdd424 in __kernel_vsyscall () (gdb) cont Continuing. Program received signal SIGPIPE, Broken pipe. 0xb7fdd424 in __kernel_vsyscall () (gdb) cont Continuing. Program received signal SIGSEGV, Segmentation fault. 0xb7e518fc in ?? () from /lib/i386-linux-gnu/libc.so.6 (gdb) where #0 0xb7e518fc in ?? () from /lib/i386-linux-gnu/libc.so.6 #1 0xb7e45e7c in _IO_default_xsputn () from /lib/i386-linux-gnu/libc.so.6 #2 0xb7e443a1 in _IO_file_xsputn () from /lib/i386-linux-gnu/libc.so.6 #3 0xb7e39025 in fwrite () from /lib/i386-linux-gnu/libc.so.6 #4 0x080ac05b in ?? () #5 0x080b6bde in PyEval_EvalFrameEx () #6 0x080b71c0 in PyEval_EvalFrameEx () #7 0x0811f939 in PyEval_EvalCodeEx () #8 0x080b80d4 in PyEval_EvalFrameEx () #9 0x080b71c0 in PyEval_EvalFrameEx () #10 0x0811f939 in PyEval_EvalCodeEx () #11 0x080b7265 in PyEval_EvalFrameEx () #12 0x080b71c0 in PyEval_EvalFrameEx () #13 0x0811f939 in PyEval_EvalCodeEx () #14 0x081203ee in ?? () #15 0x080e11f9 in ?? () #16 0x080e3daf in PyObject_Call () #17 0x08129483 in ?? () #18 0x080b8a3e in PyEval_EvalFrameEx () #19 0x0811f939 in PyEval_EvalCodeEx () #20 0x0812029e in ?? () #21 0x080e11f9 in ?? () #22 0x080e3daf in PyObject_Call () ---Type <return> to continue, or q <return> to quit--- #23 0x0816dd88 in ?? () #24 0x080b7615 in PyEval_EvalFrameEx () #25 0x0811f939 in PyEval_EvalCodeEx () #26 0x081836c7 in PyEval_EvalCode () #27 0x08183b7d in ?? () #28 0x080a6032 in PyRun_FileExFlags () #29 0x080a65f8 in PyRun_SimpleFileExFlags () #30 0x080a74af in Py_Main () #31 0x080a7581 in main () (gdb) ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18356> _______________________________________
Torim added the comment: I would add even the linked solution from StackOverflow.com does not work reliably for me. Try to get at the end of numpy document - text vanishes and possibly lose chars displaying in terminal. Need to reset it. Modified pydoc's pipepager method this way: def pipepager(text, cmd): """Page through text by feeding it to another program.""" #pipe = os.popen(cmd, 'w') import subprocess pipep = subprocess.Popen(cmd, stdin=subprocess.PIPE, shell=True) try: #pipe.write(text) #pipe.close() pipep.communicate(text) except IOError: pass # Ignore broken pipes caused by quitting the pager program. Works for me so far, although the exact cause of issue with the stock/default pydoc is still not known. ---------- components: +Library (Lib) nosy: +torim _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18356> _______________________________________
Cheryl Sabella <chekat2@gmail.com> added the comment: It appears that the suggested change from SO was implemented under issue23374 and issue23792. I cannot recreate this on Ubuntu 16.04, so closing as resolved. ---------- assignee: docs@python -> nosy: +csabella resolution: -> fixed stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue18356> _______________________________________
participants (6)
-
Cheryl Sabella
-
Christian Heimes
-
Michelle Arzul
-
R. David Murray
-
STINNER Victor
-
Torim