[ python-Bugs-975387 ] Python and segfaulting extension modules
SourceForge.net
noreply at sourceforge.net
Sun Jun 20 17:10:26 EDT 2004
Bugs item #975387, was opened at 2004-06-18 16:32
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=975387&group_id=5470
Category: Python Interpreter Core
Group: Python 2.3
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Folke Lemaitre (zypher)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python and segfaulting extension modules
Initial Comment:
Normally when a segfault occurs in a python thread
(mainly in extension modules), two things can happen:
* Python segfaults
* Python uses 99% CPU while Garbage Collecting the
same INVALID object over and over again
The second result is reported as a bug somewhere else.
In a python program with lots of threads and lots of
loaded extension modules it is almost impossible to find
the cause of a segfault.
Wouldn't it be possible to have some traceback printed
when a SIGSEGV occurs? Would be really very handy.
There even exists an extension module that does just
that, but unfortunately only intercepts problems from
the main thread. (http://systems.cs.uchicago.edu/wad/)
I think something similar should be standard behaviour of
python.
Even nicer would be if python just raises an exception
encapsulating the c stacktrace or even converting a c
trace to a python traceback
Example WAD output:
WAD can either be imported as a Python extension
module or linked to an extension module. To illustrate,
consider the earlier example:
% python foo.py
Segmentation Fault (core dumped)
%
To identify the problem, a programmer can run Python
interactively and import WAD as follows:
% python
Python 2.0 (#1, Oct 27 2000, 14:34:45)
[GCC 2.95.2 19991024 (release)] on sunos5
Type "copyright", "credits" or "license" for more
information.
>>> import libwadpy
WAD Enabled
>>> execfile("foo.py")
Traceback (most recent call last):
File "", line 1, in ?
File "foo.py", line 16, in ?
foo()
File "foo.py", line 13, in foo
bar()
File "foo.py", line 10, in bar
spam()
File "foo.py", line 7, in spam
doh.doh(a,b,c)
SegFault: [ C stack trace ]
#2 0x00027774 in call_builtin
(func=0x1c74f0,arg=0x1a1ccc,kw=0x0)
#1 0xff022f7c in _wrap_doh
(0x0,0x1a1ccc,0x160ef4,0x9c,0x56b44,0x1aa3d8)
#0 0xfe7e0568 in doh(a=0x3,b=0x4,c=0x0) in 'foo.c',
line 28
/u0/beazley/Projects/WAD/Python/foo.c, line 28
int doh(int a, int b, int *c) {
=> *c = a + b;
return *c;
}
>>>
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2004-06-20 23:10
Message:
Logged In: YES
user_id=21627
This is not a bug report: there is no specific bug being
reported.
Instead, it is a feature request, but I'd like to reject it,
as it is unimplementable, in a generic, platform-independent
way. The fact that WAD only works for the main thread should
be reported as a bug report to the WAD maintainers.
If you think something should be done about this, please
contribute patches. I personally prefer to use a
fully-featured debugger to analyse problems in extension
modules.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=975387&group_id=5470
More information about the Python-bugs-list
mailing list