Segmentation Fault on exit

Vipul Raheja vipul.iiith at gmail.com
Sat Aug 6 13:16:35 CEST 2011


Hi Chris,

Thanks for the reply.

However, the error occurs even if I don't do anything, that is, even if I
simply import the library and exit() after that.

I created a file a.py whose contents were the following:

import pyossim
exit()

Upon execution, the log was as follows:

vipul at vipul-laptop:~/ossim-svn/src/pyossim/swig$ python a.py
Segmentation fault

Following was the gdb log:

vipul at vipul-laptop:~/ossim-svn/src/pyossim/swig$ gdb `which python`
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 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/python...(no debugging symbols found)...done.

(gdb) run a.py
Starting program: /usr/bin/python a.py
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00000029 in ?? ()

(gdb) bt
#0  0x00000029 in ?? ()
#1  0x0171de9f in OpenThreads::Mutex::~Mutex() () from
/usr/lib/libOpenThreads.so.13
#2  0x0035369e in ?? () from /lib/libc.so.6
#3  0x0035370f in exit () from /lib/libc.so.6
#4  0x080fc854 in ?? ()
#5  0x080fcdf5 in ?? ()
#6  0x080fdc9b in PyRun_SimpleFileExFlags ()
#7  0x0805b6d3 in Py_Main ()
#8  0x0805a8ab in main ()

(gdb)

Regards,
Vipul Raheja


On Sat, Aug 6, 2011 at 4:32 PM, Chris Angelico <rosuav at gmail.com> wrote:

> On Sat, Aug 6, 2011 at 11:35 AM, Vipul Raheja <vipul.iiith at gmail.com>
> wrote:
> > Hi,
> >
> > I have wrapped a library from C++ to Python using SWIG. But when I
> > import it in Python, I am able to work fine with it, but it gives a
> > segmentation fault while exiting. Following is the log:
>
> The most likely cause of this is that you DECREF'd an object when you
> shouldn't have, or failed to INCREF one when you should have. Check
> over your object usage; if you can narrow down the "Do some stuff" bit
> to the one function call that causes the crash, it'll help you figure
> out where the error is.
>
> Hope that helps!
>
> Chris Angelico
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110806/ef1d7ccd/attachment.html>


More information about the Python-list mailing list