Itamar If you still have my test-case for StandardAnalyzer, here's an easy way to reproduce this crash:
in my_test_main.cpp ---> 1) after #includes, add this: bool __stdcall DllMain( unsigned short hinstDLL, // DLL module handle _cl_dword_t fdwReason, // reason called void*); // reserved 2) after s->close(), add these: DllMain(0,3,NULL); // <--- trace from here & see how the crash occurs DllMain(0,3,NULL); No sure if that's intentional -- but _CLDELETE(threadData) appears only in _ThreadLocal::_shutdown() and is absent from the destructor. Regards Celto On Fri, Nov 13, 2009 at 9:11 AM, cel tix44 <celti...@gmail.com> wrote: > Itamar > > I'm afraid it's a stopgap only. No tests done to see how it affects > multi-threaded use or if it breaks anything else. > > Also, having DllMain in ThreadLocal.cpp is a problem for those who > implement their own DllMain -- so you're right, let's leave it for Ben > to review and / or wait for Isidor to finish his work. > > Regards > Celto > > > On Fri, Nov 13, 2009 at 4:09 AM, Itamar Syn-Hershko > <ita...@divrei-tora.com> wrote: >> Celto, >> >> Is this a stopgap or an actual fix? I'm less familiar with the code there, >> it's more of Ben's work (and we are about to move to Boost Threads -- still >> waiting for the person to take this up to completion) so I'd rather not >> touch it for now unless there is a proven test case to make it crash and >> then this fix indeed resolves the issue without breaking anything else. >> >> BTW, as _internal is always created using new (as opposed to _CLNEW) >> internally, you would rather use delete _internal; than the _CLDELETE macro. >> You can also nullify it yourself, but there's no point in nullifying member >> variables in the destructor unless they are shared. >> >> Itamar. >> >> -----Original Message----- >> From: cel tix44 [mailto:celti...@gmail.com] >> Sent: Wednesday, November 11, 2009 1:04 AM >> To: clucene-developers@lists.sourceforge.net >> Subject: [CLucene-dev] Branch 2.3.2 -- crash in ThreadLocal.cpp >> >> Team >> >> I hit a crash while testing a DLL compiled from the GIT branch marked "ASCII >> + misc fixes". I used CMake 2.6.4 to generate code for VS 2008 with >> ENABLE_ASCII_MODE | DISABLE_MULTITHREADING. >> >> It appears that (under certain circumstances) DLLMain implemented in >> ThreadLocal.cpp gets invoked with fdwReason=3 (DLL_THREAD_DETACH) more than >> once. As my test is compiled with DISABLE_MULTITHREADING, >> UnregisterCurrentThread() attempts to unregister the same (current) thread >> more than once, which causes Access Violation with NULL pointers or pointers >> to 0xFEEEFEEE (freed memory). >> >> As a stopgap, I used the fix below. >> >> Regards >> Celto >> >> ------------------------- >> 1) in _ThreadLocal::~_ThreadLocal(): >> replace this line: >> delete _internal; >> with: >> _CLDELETE(_internal); >> _CLDELETE(threadData); >> >> 2) in _ThreadLocal::setNull() >> add this check: >> if (_internal == NULL ){ >> return; >> } >> >> ---------------------------------------------------------------------------- >> -- >> 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 >> >> >> >> ------------------------------------------------------------------------------ >> 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 >> > ------------------------------------------------------------------------------ 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