On Mar 10, 2009, at 10:13, Christian Heimes <li...@cheimes.de> wrote:
Hello!
A couple of months ago we ran into a strange problem with signals in
our
application stack. Whenever lucene was loaded, our application didn't
react to SIGINT (ctrl + c) properly. Instead of shutting down step by
step the server stopped immediately.
It took me a while to figure out that lucene.initVM() replaces
Python's
SIGINT handler with a new signal handler. Python's SIGINT handler is
responsible for raising a KeyboardInterrupt exception when ctrl+c is
pressed. The JVM grabs a whole bunch of signals for its own purpose
and
thus disables all signal handlers installed before initVM().
The fact is well documented at
http://www.ibm.com/developerworks/java/library/i-signalhandling/
together with an easy solution (-Xrs option). Sun's JVM behaves
equally.
My Python package smc.lucene goes a slightly different way. It saves
all
Python signal handlers before initVM() is called and restores them
afterwards. However that's not an appropriate solution for an embedded
Python interpreter (Python embedded in Apache via mod_python which
itself hosts an embedded JVM via JCC).
Andi, do you see a way to fix the problem inside initVM() anytime
soon?
It's not initVM's doing but the Java VM initialization code that it
calls and initVM has some control over it via initialization
parameters (equivalent to java's command line parameters).
You can call initVM(vmargs='-Xrs') but you seem to imply that this
isn't good enough. I guess I'm not sure I completely understand your
question.
Andi..
Christian