Segmentation Fault on exit

Vipul Raheja vipul.iiith at
Sat Aug 6 07:16:35 EDT 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 whose contents were the following:

import pyossim

Upon execution, the log was as follows:

vipul at vipul-laptop:~/ossim-svn/src/pyossim/swig$ python
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 <
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:
Reading symbols from /usr/bin/python...(no debugging symbols found)...done.

(gdb) run
Starting program: /usr/bin/python
[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
#2  0x0035369e in ?? () from /lib/
#3  0x0035370f in exit () from /lib/
#4  0x080fc854 in ?? ()
#5  0x080fcdf5 in ?? ()
#6  0x080fdc9b in PyRun_SimpleFileExFlags ()
#7  0x0805b6d3 in Py_Main ()
#8  0x0805a8ab in main ()


Vipul Raheja

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

> On Sat, Aug 6, 2011 at 11:35 AM, Vipul Raheja <vipul.iiith at>
> 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
> --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list