The following program reproduces the crash (may need to be run on a 
32-bit machine though):


#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <CLucene.h>

#define ITERATIONS 550000
#define INDEX_PATH "data/testcl"
#define USE_PER_FIELD_ANALYZER
#define SUB_ANALYZER_TYPE lucene::analysis::WhitespaceAnalyzer
//#define SUB_ANALYZER_TYPE lucene::analysis::standard::StandardAnalyzer

const TCHAR *genValue()
{
   static TCHAR buf[4096];
   for (unsigned int i = 0; i < sizeof (buf) / sizeof (*buf); i++)
     buf[i] = ' ' + (rand() % 16);
   return buf;
}

int main(int argc, char *argv[]) {
   srand(time(NULL));
   try {
#ifdef USE_PER_FIELD_ANALYZER
     lucene::analysis::PerFieldAnalyzerWrapper analyzer(
       _CLNEW lucene::analysis::standard::StandardAnalyzer());
     analyzer.addAnalyzer(_T("First"), _CLNEW SUB_ANALYZER_TYPE());
     analyzer.addAnalyzer(_T("Second"), _CLNEW SUB_ANALYZER_TYPE());
     analyzer.addAnalyzer(_T("Third"), _CLNEW SUB_ANALYZER_TYPE());
     analyzer.addAnalyzer(_T("Fourth"), _CLNEW SUB_ANALYZER_TYPE());
     analyzer.addAnalyzer(_T("Fifth"), _CLNEW SUB_ANALYZER_TYPE());
#else
     lucene::analysis::WhitespaceAnalyzer analyzer;
#endif
     lucene::index::IndexWriter writer(INDEX_PATH, &analyzer, true);
     writer.setRAMBufferSizeMB(512);
     lucene::document::Document doc;
     int flags = lucene::document::Field::STORE_YES
                 | lucene::document::Field::INDEX_TOKENIZED;
     for (int i = 0; i < ITERATIONS; i++) {
       doc.clear();
       doc.add(*(_CLNEW lucene::document::Field(
         _T("First"), genValue(), flags)));
       doc.add(*(_CLNEW lucene::document::Field(
         _T("Second"), genValue(), flags)));
       doc.add(*(_CLNEW lucene::document::Field(
         _T("Fifth"), genValue(), flags)));
       doc.add(*(_CLNEW lucene::document::Field(
         _T("Eigth"), genValue(), flags)));
       doc.add(*(_CLNEW lucene::document::Field(
         _T("Ninth"), genValue(), flags)));
       writer.addDocument(&doc);
     }
     writer.close();
   } catch (CLuceneError err) {
     printf("CLuceneError: %s", err.what());
   }
   return 0;
}


Michael Levin wrote:
> I get an exception whenever CLucene grows an index file to exactly 2GB. 
> This sounds like it could be a 32-bit overflow problem. Here is what I 
> get out of gdb:
> 
>> pure virtual method called
>> terminate called after throwing an instance of 
>> 'lucene::index::AbortException'
>>
>> Program received signal SIGABRT, Aborted.
>> 0x007bb422 in __kernel_vsyscall ()
>> (gdb) up
>> #1  0x0013a4d1 in *__GI_raise (sig=6)
>>     at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
>> 64   ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
>>      in ../nptl/sysdeps/unix/sysv/linux/raise.c
>> Current language:  auto
>> The current source language is "auto; currently c".
>> (gdb) 
>> #2  0x0013d932 in *__GI_abort () at abort.c:92
>> 92   abort.c: No such file or directory.
>>      in abort.c
>> (gdb) 
>> #3  0x003294df in __gnu_cxx::__verbose_terminate_handler() ()
>>    from /usr/lib/libstdc++.so.6
>> (gdb) 
>> #4  0x00327415 in ?? () from /usr/lib/libstdc++.so.6
>> (gdb) 
>> #5  0x00327452 in std::terminate() () from /usr/lib/libstdc++.so.6
>> (gdb) 
>> #6  0x00328105 in __cxa_pure_virtual () from /usr/lib/libstdc++.so.6
>> (gdb) 
>> #7  0x003ecf90 in lucene::store::BufferedIndexOutput::flush (this=0x8073fc0)
>>     at 
>> /mnt/rohan/risujin/src/mimir/isic/lib/clucene/src/core/CLucene/store/IndexOutput.cpp:192
>> 192      flushBuffer(buffer, bufferPosition);
>> Current language:  auto
>> The current source language is "auto; currently c++".
>> (gdb) print flushBuffer
>> Cannot take address of method flushBuffer.
>> (gdb) print this
>> $1 = (lucene::store::BufferedIndexOutput * const) 0x8073fc0
>> (gdb) print *this
>> $2 = {<lucene::store::IndexOutput> = {<lucene::debug::LuceneVoidBase> = {
>>       _vptr.LuceneVoidBase = 0x4e2668}, isclosed = false, 
>>     static COPY_BUFFER_SIZE = 16384, copyBuffer = 0x0}, 
>>   static BUFFER_SIZE = 16384, 
>>   buffer = 0x8073fe8 "ive-defense capacity (indicated by a 29% increase in 
>> glutathione concentration), prevented jejunal atrophy, and promoted small 
>> intestine growth (+12%) and body weight gain (+19%) in weaned piglets. 
>> Th"..., 
>>   bufferStart = 2147467264, bufferPosition = 16384}

-- 
Michael Levin <mele...@stanford.edu>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to