
Hi Holger, Holger Joukl wrote:
I run into segfaults using a python2.3, gcc 2.95.2 - build (yes I know, mighty old compiler :-):
and difficult to track down problems. Impossible to say if it's because of a specific system environment (who compiled your pthreads, for example? where did your Python binary come from?) or because of the compiler itself, specific compiler options... Have you tried it with 'safe' options like "-O -m386" and the like? (or the same for Solaris respectively).
Tests work fine with everything gcc3.4.4-built, using python2.4 (same lib versions)
Did you use the same compiler for the libs?
Both segfaults seem to arise when an error is raised internally (though it is unclear why the first is an error - it does not raise an exception when run under python2.4/gcc3.4.4).
But the stack trace tells me that you got a warning from libxml2 that went up into the Python environment:
1. Using unprefixed namespace:
python2.3
elt = etree.fromstring("""<RvXML xmlns="myURI"></RvXML>""") Segmentation Fault (core dumped)
Program received signal SIGSEGV, Segmentation fault. 0xff07b760 in pthread_mutex_lock () from /usr/lib/libthread.so.1 (gdb) bt #0 0xff07b760 in pthread_mutex_lock () from /usr/lib/libthread.so.1 #1 0xaa760 in PyThread_release_lock (lock=0x0) at Python/thread_pthread.h:532 #2 0x840c0 in PyEval_ReleaseThread (tstate=0x11abc0) at Python/ceval.c:339 #3 0xa4338 in PyGILState_Release (oldstate=PyGILState_UNLOCKED) at Python/pystate.c:473 #4 0xfe68ceb4 in __pyx_f_5etree__receiveError (__pyx_v_c_log_handler=0x2146c0, __pyx_v_error=0x206700) at src/lxml/etree.c:15789 #5 0xfe4324b4 in __xmlRaiseError (schannel=0xfe68ce68 <__pyx_f_5etree__receiveError>, channel=0xfe432880 <xmlParserWarning>, data=0x2146c0, ctx=0x206580, nod=0x0, domain=1, code=100, level=XML_ERR_WARNING, file=0x0, line=1, str1=0x25f01b "myURI", str2=0x0, str3=0x0, int1=0, col=13, msg=0xfe518560 "xmlns: URI %s is not absolute\n") at error.c:612 #6 0xfe43668c in xmlWarningMsg (ctxt=0xfe518560, error=XML_WAR_NS_URI_RELATIVE, msg=0xfe518560 "xmlns: URI %s is not absolute\n", str1=0x25f01b "myURI", str2=0x0) at parser.c:415 [...]
Anyway, it doesn't look like the error is the cause, it's more because of a problem when acquiring the GIL.
2. Using illegal tag names:
Here is the stack trace (no clue what the "warning: Lowest section in ..." is supposed to mean, btw):
elt = etree.fromstring('<root><k+status></k+status></root>')
Program received signal SIGSEGV, Segmentation fault. 0xff138dcc in mutex_lock_impl () from /lib/libc.so.1 (gdb) bt #0 0xff138dcc in mutex_lock_impl () from /lib/libc.so.1 #1 0xaa760 in PyThread_release_lock (lock=0x0) at Python/thread_pthread.h:532 #2 0x840c0 in PyEval_ReleaseThread (tstate=0x119cc8) at Python/ceval.c:339 #3 0xa4338 in PyGILState_Release (oldstate=PyGILState_UNLOCKED) at Python/pystate.c:473 #4 0xfef0ceb4 in __pyx_f_5etree__receiveError (__pyx_v_c_log_handler=0x2179e0, __pyx_v_error=0x209f30) at src/lxml/etree.c:15789 #5 0xfecb24b4 in __xmlRaiseError (schannel=0xfef0ce68 <__pyx_f_5etree__receiveError>, channel=0, data=0x2179e0, ctx=0x209db0, nod=0x0, domain=1, code=68, level=XML_ERR_FATAL, file=0x0, line=1, str1=0x0, str2=0x0, str3=0x0, int1=0, col=9, msg=0xfed982d8 "error parsing attribute name\n") at error.c:612 #6 0xfecb65c0 in xmlFatalErrMsg (ctxt=0x209db0, error=XML_ERR_NAME_REQUIRED, msg=0xfed982d8 "error parsing attribute name\n") at parser.c:387
Looks pretty similar to me, both segfault in pthreads mutex calls. Maybe it's not a compiler issue but an issue with Python 2.3 on Solaris - or a mixture of many causes...
Both work fine with python2.4, compiled with gcc 3.4.4: [...]
Uhm, on the same machine? What do you need the gcc 2.95 for, then? Personally, I feel no big incentive in supporting a compiler as old as 2.95. GCC is at version 4 by now and if we run fine with 3.4, that's all I'd ask for. Stefan