[pylucene-dev] two different JCC modules in same VM; initVM()?
Andi Vajda
vajda at osafoundation.org
Thu Mar 6 22:03:35 PST 2008
On Thu, 6 Mar 2008, Bill Janssen wrote:
>> Hmmm, when I think about it, there's no way this can work. The
>> comparison in jcc.cpp is
>>
>> if (!PyObject_TypeCheck((PyObject *) jccenv, &JCCEnvType))
>>
>> and PyObject_TypeCheck compares the two pointers for equality, but the
>> two different "JCCEnvType" variables are in two different shared
>> libraries. So they'll never match.
>
> So I tried changing this to
>
> if (strncmp(((PyObject *) jccenv)->ob_type->tp_name,
> JCCEnvType.tp_name,
> strlen(JCCEnvType.tp_name)) != 0)
>
> But now I get this:
The bug is probably due to the static variables in JCCEnv.cpp that help me
with storing the thread-specific VM env (not the JCC env, but the return
value from attachCurrentThread()). To get the VM env, I call (a lot)
env->get_vm_env() which accesses thread local storage via a static
pthread_key_t. That static is not initialized in the second shared lib. It
should move to the env instead.
More on this in the next few days...
Andi..
>
>>>> goodstuff.initVM(env=lucene.getVMEnv(), classpath=":".join([lucene.CLASSPATH, "GoodStuff.jar"]))
> [Switching to Thread -1208796976 (LWP 28390)]
>
> Breakpoint 1, initVM (self=0x0, args=0xb7ef302c, kwds=0xa2d8934)
> at /usr/lib/python2.5/site-packages/JCC-1.8-py2.5-linux-i686.egg/jcc/sources/jcc.cpp:561
> 561 if (classpath)
> (gdb) p classpath
> $7 = 0xa2c3d6c "/usr/lib/python2.5/site-packages/lucene-2.3.0-py2.5-linux-i686.egg/lucene/lucene-core-2.3.0.jar:/usr/lib/python2.5/site-packages/lucene-2.3.0-py2.5-linux-i686.egg/lucene/lucene-snowball-2.3.0.jar:/usr"...
> (gdb) s
> 562 env->setClassPath(classpath);
> (gdb) s
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00c9db70 in initVM (self=0x0, args=0xb7ef302c, kwds=0xa2d8934)
> at /usr/lib/python2.5/site-packages/JCC-1.8-py2.5-linux-i686.egg/jcc/sources/jcc.cpp:562
> 562 env->setClassPath(classpath);
> (gdb) p env
> $8 = (class JCCEnv *) 0x9f5cce0
> (gdb) p *env
> $9 = {_vptr.JCCEnv = 0x136f9c8, _sys = 0x9ff6554, _obj = 0x9ff6558, _thr = 0x9ff655c, _mids = 0x9f5cd38, vm = 0x19f792c,
> refs = {_M_t = {
> _M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<const int, countedRef> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<const int, countedRef> > >> = {<No data fields>}, <No data fields>},
> _M_key_compare = {<> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red,
> _M_parent = 0x9f5cf18, _M_left = 0xa2ac770, _M_right = 0xa013a20}, _M_node_count = 226}}}, static VM_ENV = 0}
> (gdb)
> _______________________________________________
> 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