Program terminated with signal 11, Segmentation fault.
Environment: FreeBSD 6.2, Python 2.4.4, MySQLdb 1.2.2, SQLObject 0.9.1

I faced with an error in our multithreaded, network oriented application, wich interacts actively with MySQL database. Brief information from core dump is below (more detailed one is in the file attached).

Though I am not very experienced with FreeBSD and gdb, I have still tried to collect information about the error. As far as I understand there is recursion in thread 14, which is a reason of the error. Even though I tried to track it down I didn't manage to do it.

I'll be happy to hear any comments, suggestions and any support to my assumption.

TIA

Here is a link to the full gdb info: http://paste-it.net/5038

...

#0 0x0000000800b5356c in pthread_testcancel () from /lib/libpthread.so.2
[New Thread 0x2a6f800 (sleeping)]
[New Thread 0x1786800 (sleeping)]
[New Thread 0x1739000 (sleeping)]
[New Thread 0x1792400 (runnable)]
[New Thread 0x1791800 (sleeping)]
[New Thread 0x1791400 (sleeping)]
[New Thread 0x1791000 (sleeping)]
[New Thread 0x178cc00 (sleeping)]
[New Thread 0x178c400 (sleeping)]
[New Thread 0x1731400 (sleeping)]
[New Thread 0x1690c00 (sleeping)]
[New Thread 0x14f8800 (sleeping)]
[New Thread 0x14f8400 (LWP 100180)]
[New Thread 0x639000 (runnable)]
[New LWP 100087]
(gdb)

...

(gdb) bt
#0 0x0000000800b5352c in pthread_testcancel () from /lib/libpthread.so.2
#1 0x0000000800b42000 in sigaction () from /lib/libpthread.so.2
#2 0x0000000800b4bf1a in pthread_mutexattr_init () from /lib/libpthread.so.2
#3 0x0000000000000000 in ?? ()
Cannot access memory at address 0x7fffffbff000

...

(gdb) info threads
* 15 LWP 100087 0x0000000800b5356c in pthread_testcancel ()
from /lib/libpthread.so.2
14 Thread 0x639000 (runnable) 0x0000000802b33858 in seq2set (seq=0x5e7520,
set=0x7fffffff1850, fd2obj=0x7fffffff5960)
at /usr/local/ports/distfiles/python/Python-2.4.4/Modules/selectmodule.c:100
13 Thread 0x14f8400 (LWP 100180) 0x0000000800b5352c in pthread_testcancel ()
from /lib/libpthread.so.2
12 Thread 0x14f8800 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
11 Thread 0x1690c00 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
10 Thread 0x1731400 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
9 Thread 0x178c400 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
8 Thread 0x178cc00 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
7 Thread 0x1791000 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
6 Thread 0x1791400 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
5 Thread 0x1791800 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
4 Thread 0x1792400 (runnable) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
3 Thread 0x1739000 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
2 Thread 0x1786800 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2
1 Thread 0x2a6f800 (sleeping) 0x0000000800b4bfdf in pthread_mutexattr_init
() from /lib/libpthread.so.2

Can you play with sys.setrecursionlimit( limit)?

This sets the maximum depth of the Python interpreter stack to limit. This limit prevents infinite recursion from causing an overflow of the C stack and crashing Python.
The highest possible limit is platform-dependent. A user may need to set the limit higher when she has a program that requires deep recursion and a platform that supports a higher limit. This should be done with care, because a too-high limit can lead to a crash.

Can you play with sys.setrecursionlimit( limit)?

Yes, I set it to 50 (instead of default value 1000) and it takes no effect. I have additional info: if I kill my process by cmd "kill -11 94000" the core dump contains the same info about thread 14 (about 670 lines of bt). I don't know what it means, but it's obvious (I suppose this is main thread) that such bt is normal for the thread and this thread is not an error cause.

So. help is still needed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.