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?

Christian

Reply via email to