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
case.

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
mailing list....


Relevant information:
  Webware 0.8.1
  Fedora Core 3 Linux
  mod_webkit2, apache 2.0.52
  Python 2.4 (python.org RPM)
  PyLucene: http://pylucene.osafoundation.org/

Servlet class, DemonstrateCrash.py:
  import PyLucene
  from WebKit import Page

  class DemonstrateCrash(Page.Page):
    pass
  # EOF

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
  (gdb)


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to