Hi. I have a simple servlet class that does nothing but import
PyLucene, which is a swigged python wrapper around the Java Lucene
library, compiled to native code via gcj.
I've seen behavior like this in the past -- it seems to have something
to do with thread-unsafe behavior by native modules. Previously I was
seeing it with MySQLdb, and using a Lock to prevent simultaneous
access to thread objects made the segfaults stop happening in that
There was at least one brief thread in this mailing list that came to
the same conclusion ("Segmentation fault in ThreadedAppServer", 06 Feb
2002). I don't really know anything about this PyLucene library's
internals and would prefer not to have to -- do we know generally why
this happens and if there's an easy way to avoid it?
The previous thread suggested a simplistic test (running an
interpreter, making a couple toy threads, using the native module,
seeing if the segfault could be reproduced). This does not reproduce
the segfault for me, for whatever reason. Any suggestions would be
welcomed, including how I might be able to reproduce the problem
outside of Webware. If we can come up with a repro case it would be
handy because then I could go to the Python newsgroup and the PyLucene
Fedora Core 3 Linux
mod_webkit2, apache 2.0.52
Python 2.4 (python.org RPM)
Servlet class, DemonstrateCrash.py:
from WebKit import Page
What happens to AppServer on requesting that page:
Listening on ('127.0.0.1', 8086)
Creating 10 threads..........
Ready (0.11 seconds after launch)
1 2005-04-05 17:41:46 /WK/DemonstrateCrash
./AppServer: line 9: 5414 Segmentation fault (core dumped) /usr/bin/env python Launch.py ThreadedAppServer $*
The last few lines of the backtrace from the core dump:
#71 0x0805bdb0 in PyObject_Call ()
#72 0x080641d5 in instancemethod_call ()
#73 0x0805bdb0 in PyObject_Call ()
#74 0x080aec4b in PyEval_CallObjectWithKeywords ()
#75 0x080e213e in t_bootstrap ()
#76 0x0084a3ae in start_thread () from /lib/tls/libpthread.so.0
#77 0x006c9b6e in clone () from /lib/tls/libc.so.6
> Hi. I have a simple servlet class that does nothing but import
> PyLucene, which is a swigged python wrapper around the Java Lucene
> library, compiled to native code via gcj.
> I've seen behavior like this in the past -- it seems to have something
> to do with thread-unsafe behavior by native modules. Previously I was
> seeing it with MySQLdb, and using a Lock to prevent simultaneous
> access to thread objects made the segfaults stop happening in that
did you solve the problem with pylucene and webware finally?
if yes, how?
i have the very same problem at the moment.. no clue what could help.
On Tue, 6 Feb 2007 21:21:11 +0000 (UTC)
Cornelius <me@...> wrote:
> did you solve the problem with pylucene and webware finally?
> if yes, how?
> i have the very same problem at the moment.. no clue what could help.
just a little bit off topic. But have you checked out
Its using Lucene technology but you don't have to deal directly
with it. Just send your requests to the solr server and get
Example client can be found here