[pylucene-dev] pylucene crashes if JVM not initialized

Andi Vajda vajda at osafoundation.org
Fri Jun 13 08:32:55 PDT 2008


On Jun 13, 2008, at 6:58 AM, Felix Schwarz  
<felix.schwarz at oss.schwarz.eu> wrote:

> Hi,
>
> currently, pylucene gets a SIGSEGV as soon you call a Java method  
> without
> previously initializing the JVM (or attaching the current thread).
>
> I know the root cause (no initialization) is a programmer error and  
> pylucene
> has its reasons to not initialize the JVM automatically.
>
> But I think pylucene should not crash but just throw a JavaError  
> which can
> be catched as every other Python exception.

I tried to implement that a while ago.
The problem is that, to avoid the crash, the generated code has to  
check that the VM is initialized all the time and everywhere. I didn't  
find a single point of passage where to add that (simple) check.  
Adding it everywhere is a lot of code to add for a simple to fix user  
error.

No, findClass() is not it, since a class can be loaded by thread and  
used by another.

If you have a better idea or a patch, send it in !

Andi..

> I experienced some crashes because
> my thread configuration was wrong and it was not too easy finding  
> the cause.
>
> Maybe this is already fixed in SVN? I'm using JCC 1.9 and PyLucene  
> 2.3.2.1 on
> CentOS 5 (i386) together with OpenJDK (1.6.0.0-0.7.b08.el5.2).
>
> fs
> <uninitialized_lucene.py>
> _______________________________________________
> pylucene-dev mailing list
> pylucene-dev at osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/pylucene-dev


More information about the pylucene-dev mailing list