[pylucene-dev] NullPointerException in IndexSearcher.search

Andi Vajda vajda at osafoundation.org
Wed Jan 30 22:43:57 PST 2008


On Jan 31, 2008, at 3:05, "James Brady" <rent.lupin.road at gmail.com>  
wrote:

> Hi,
> I'm running PyLucene version 2.2.0-1 (compiled from source) on a 64- 
> bit EC2 instance:
> $ uname -a
> Linux domU-12-31-39-00-08-41 2.6.16.33-xenU #2 SMP Wed Aug 15  
> 17:27:36 SAST 2007 x86_64 x86_64 x86_64 GNU/Linux
>
> I'm using PyLucene through a modified TurboLucene layer - the  
> following code is giving me a segfault:
>         searcher = IndexSearcher(_get_index_path
> (language))
> ...
>         try:
>             comboQuery = BooleanQuery()
>             if query:
>                 comboQuery.add(parser.parse(query),  
> BooleanClause.Occur.MUST)
>             for filter in filters:
>                 comboQuery.add(filter.getQuery(), filter.getOccur())
>
>             _log.debug("Executing query: %s -- sort: %s (%s -> %s)" %
>                        (comboQuery, sort, start_offset, end_offset))
>             hits = searcher.search(comboQuery, sort)
>
> It's the searcher.search line at fault - my code catches a Java  
> NullPointerException. Here's the gdb output:
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1224808768 (LWP 26910)]
> 0x00002aaaab41a487 in org::apache::lucene::search::IndexSearcher 
> $1::collect () from /usr/lib64/python2.4/site-packages/_PyLucene.so
> (gdb) where
> #0  0x00002aaaab41a487 in org::apache::lucene::search::IndexSearcher 
> $1::collect () from /usr/lib64/python2.4/site-packages/_PyLucene.so
> #1  0x00002aaaab4105fb in  
> org::apache::lucene::search::BooleanScorer2::score () from /usr/ 
> lib64/python2.4/site-packages/_PyLucene.so
> #2  0x00002aaaab41a802 in  
> org::apache::lucene::search::IndexSearcher::search () from /usr/ 
> lib64/python2.4/site-packages/_PyLucene.so
> #3  0x00002aaaab41a66b in  
> org::apache::lucene::search::IndexSearcher::search () from /usr/ 
> lib64/python2.4/site-packages/_PyLucene.so
> #4  0x00002aaaab41a17e in  
> org::apache::lucene::search::Hits::getMoreDocs () from /usr/lib64/ 
> python2.4/site-packages/_PyLucene.so
> #5  0x00002aaaab4248f1 in  
> org::apache::lucene::search::Searcher::search () from /usr/lib64/ 
> python2.4/site-packages/_PyLucene.so
> #6  0x00002aaaab4bb20f in wrap_LucenePackage () from /usr/lib64/ 
> python2.4/site-packages/_PyLucene.so
> #7  0x00002b9eba1410a8 in PyEval_EvalFrame () from /usr/lib64/ 
> libpython2.4.so.1.0
> #8  0x00002b9eba140a5d in PyEval_EvalFrame () from /usr/lib64/ 
> libpython2.4.so.1.0
> #9  0x00002b9eba140a5d in PyEval_EvalFrame () from /usr/lib64/ 
> libpython2.4.so.1.0
> #10 0x00002b9eba141e50 in PyEval_EvalCodeEx () from /usr/lib64/ 
> libpython2.4.so.1.0
> #11 0x00002b9eba0f8603 in PyClassMethod_New () from /usr/lib64/ 
> libpython2.4.so.1.0
> #12 0x00002b9eba0e2140 in PyObject_Call () from /usr/lib64/ 
> libpython2.4.so.1.0
> #13 0x00002b9eba0e822f in PyClass_IsSubclass () from /usr/lib64/ 
> libpython2.4.so.1.0
> #14 0x00002b9eba0e2140 in PyObject_Call () from /usr/lib64/ 
> libpython2.4.so.1.0
> #15 0x00002aaaab4a21d5 in callPython () from /usr/lib64/python2.4/ 
> site-packages/_PyLucene.so
> #16 0x00002aaaab49585c in  
> org::osafoundation::util::PythonRunnable::run () from /usr/lib64/ 
> python2.4/site-packages/_PyLucene.so
> #17 0x00002aaaad0bc1b6 in java::lang::Thread::run () from /usr/lib64/ 
> libgcj.so.7rh
> #18 0x00002aaaacdc0638 in _Jv_ThreadRun () from /usr/lib64/libgcj.so. 
> 7rh
> #19 0x00002aaaacdc6ec7 in _Jv_ThreadRegister () from /usr/lib64/ 
> libgcj.so.7rh
> #20 0x00002aaaad508f86 in _Jv_strtod_r () from /usr/lib64/libgcj.so. 
> 7rh
> #21 0x00002b9eba3e62f7 in start_thread () from /lib64/libpthread.so.0
> #22 0x00002b9ebad5386d in clone () from /lib64/libc.so.6
> #23 0x0000000000000000 in ?? ()
>
> I know 64-bit support is experimental, but does anyone have any  
> suggestions on how I can work round this?

It appears that you're running the GCJ flavor of PyLucene. Does 'make  
test' pass ?

Switching to the JCC flavor of PyLucene has a very good chance of  
working around this problem.

Andi..

>
>
> Thanks!
> James
> _______________________________________________
> 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