Author Topic: SVN version 4475 crashes on exit  (Read 5307 times)

Offline ironhead

  • Almost regular
  • **
  • Posts: 210
SVN version 4475 crashes on exit
« on: September 18, 2007, 01:26:18 pm »
I've compiled version 4475 from svn and it always crashes when exiting.  This did not occur with the previous version I compiled (4472).  I compiled using MinGW on a Windows XP Professional machine.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: SVN version 4475 crashes on exit
« Reply #1 on: September 18, 2007, 05:58:20 pm »
Do you have the codeblocks.RPT file at hand? Now that you say you compiled it yourself... could you try it running from src/devel?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: SVN version 4475 crashes on exit
« Reply #2 on: September 18, 2007, 08:16:22 pm »
Here is a backtrace.

Quote
Program received signal SIGSEGV, Segmentation fault.
0x7c918fea in ntdll!RtlpWaitForCriticalSection ()
   from C:\WINDOWS\system32\ntdll.dll
(gdb) bt full
#0  0x7c918fea in ntdll!RtlpWaitForCriticalSection ()
   from C:\WINDOWS\system32\ntdll.dll
No symbol table info available.
#1  0x0023ed94 in ?? ()
No symbol table info available.
#2  0x004c69e0 in MainFrame::sm_eventTableEntries ()
No symbol table info available.
#3  0x0150a038 in ?? ()
No symbol table info available.
#4  0x00030000 in ?? ()
No symbol table info available.
#5  0x0023e464 in ?? ()
No symbol table info available.
#6  0x0023e4a8 in ?? ()
No symbol table info available.
#7  0xffffffff in ?? ()
No symbol table info available.
#8  0x0023e3ac in ?? ()
No symbol table info available.
#9  0x6cd084be in wxEvtHandler::TryParent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#10 0x7c90104b in ntdll!RtlEnumerateGenericTableLikeADirectory ()
   from C:\WINDOWS\system32\ntdll.dll
No symbol table info available.
#11 0x0038fb28 in ?? ()
No symbol table info available.
#12 0x6ccfc671 in wxCriticalSection::Enter ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#13 0x6ccfe12e in wxThreadInternal::WaitForTerminate ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#14 0x6ccfe626 in wxThread::Delete () from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#15 0x65e9c3b1 in ClassBrowser::~ClassBrowser (this=0x2384168)
    at F:/cbsource/src/plugins/codecompletion/classbrowser.cpp:170
        pos = 96
#16 0x6ce8fee5 in wxWindowBase::Destroy ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#17 0x65eb545a in NativeParser::RemoveClassBrowser (this=0x222cca0,
    appShutDown=true)
    at F:/cbsource/src/plugins/codecompletion/nativeparser.cpp:184
        appShutDown = true
        idx = 1
        evt = {<> = {<No data fields>}, <BlockAllocated<CodeBlocksDockEvent,75u,
 false>> = {static allocator = {
      allocBlocks = {<_Vector_base<BlockAllocator<CodeBlocksDockEvent, 75u,  fal
se>::LinkedBlock<CodeBlocksDockEvent>*,std::allocator<BlockAllocator<CodeBlocksD
ockEvent, 75u,  false>::LinkedBlock<CodeBlocksDockEvent>*> >> = {
          _M_impl = {<allocator<BlockAllocator<CodeBlocksDockEvent, 75u,  false>
::LinkedBlock<CodeBlocksDockEvent>*>> = {<new_allocator<BlockAllocator<CodeBlock
sDockEvent, 75u,  false>::LinkedBlock<CodeBlocksDockEvent>*>> = {<No data fields
>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0,
            _M_end_of_storage = 0x0}}, <No data fields>}, first = 0x0,
      ref_count = 0, max_refs = 0, total_refs = 0}},
  name = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0x7c90ee18}, <No data fields>}, title = {<wxStringBase> = {
      static npos = 4294967295, m_pchData = 0x7c910570}, <No data fields>},
  pWindow = 0xffffffff, desiredSize = {x = 2089878893, y = 2009252574},
  floatingSize = {x = 196608, y = 0}, minimumSize = {x = 2009252579,
    y = 2354580}, dockSide = 5007840, row = 22061112, column = 1638571664,
  shown = 140, stretch = 158, hideable = 170, asTab = 97,
  bitmap = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0x23e69c}, <No data fields>},
  unused = ">»Ñaxµ#\000α\2143\002αε#\000\224\\├wp ┴w    π┬┬wσnεe╕\2143\002α\2143
\002╠µ#\000±\202∩e╕\2143\002α\2143\002ⁿµ#", static ms_classInfo = {
    m_className = 0x61a8ff84, m_objectSize = 156,
    m_objectConstructor = 0x6190ffb2 <CodeBlocksDockEvent::wxCreateObject()>,
    m_baseInfo1 = 0x6d2f59a8, m_baseInfo2 = 0x0,
    static sm_first = 0x61aad7b8, m_next = 0x61aad7a0,
    static sm_classTable = 0x32e50}}
#18 0x65ea7e24 in CodeCompletion::OnRelease (this=0x222cc50, appShutDown=true)
    at F:/cbsource/src/plugins/codecompletion/codecompletion.cpp:449
        appShutDown = true
#19 0x617df170 in cbPlugin::Release (this=0x222cc50, appShutDown=true)
    at F:/cbsource/src/sdk/cbplugin.cpp:81
        appShutDown = true
        event = {<> = {<No data fields>}, <BlockAllocated<CodeBlocksEvent,75u, f
alse>> = {static allocator = {
      allocBlocks = {<_Vector_base<BlockAllocator<CodeBlocksEvent, 75u,  false>:
:LinkedBlock<CodeBlocksEvent>*,std::allocator<BlockAllocator<CodeBlocksEvent, 75
u,  false>::LinkedBlock<CodeBlocksEvent>*> >> = {
          _M_impl = {<allocator<BlockAllocator<CodeBlocksEvent, 75u,  false>::Li
nkedBlock<CodeBlocksEvent>*>> = {<new_allocator<BlockAllocator<CodeBlocksEvent,
75u,  false>::LinkedBlock<CodeBlocksEvent>*>> = {<No data fields>}, <No data fie
lds>}, _M_start = 0x0, _M_finish = 0x0,
            _M_end_of_storage = 0x0}}, <No data fields>}, first = 0x0,
      ref_count = 0, max_refs = 0, total_refs = 0}}, m_pProject = 0x23e718,
  m_pEditor = 0x150a038, m_pPlugin = 0x23e80c, m_X = 2089872920,
  m_Y = 2089878896, m_TargetName = {<wxStringBase> = {
      static npos = 4294967295, m_pchData = 0xffffffff}, <No data fields>},
  m_OldTargetName = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0x7c91056d}, <No data fields>}, static ms_classInfo = {
    m_className = 0x61a8ff64, m_objectSize = 84,
    m_objectConstructor = 0x6190fec8 <CodeBlocksEvent::wxCreateObject()>,
    m_baseInfo1 = 0x6d2f59a8, m_baseInfo2 = 0x0,
    static sm_first = 0x61aad7b8, m_next = 0x61aaddc0,
    static sm_classTable = 0x32e50}}
        window = (struct wxWindow *) 0x61994b95
#20 0x6189d50c in PluginManager::DetachPlugin (this=0x20f2008,
    plugin=0x222cc50) at F:/cbsource/src/sdk/pluginmanager.cpp:220
No locals.
#21 0x618a632f in PluginManager::UnloadPlugin (this=0x20f2008,
    plugin=0x222cc50) at F:/cbsource/src/sdk/pluginmanager.cpp:1153
        i = 0
#22 0x618a62f2 in PluginManager::UnloadAllPlugins (this=0x20f2008)
    at F:/cbsource/src/sdk/pluginmanager.cpp:1141
No locals.
#23 0x6189d2ea in PluginManager::~PluginManager (this=0x20f2008)
    at F:/cbsource/src/sdk/pluginmanager.cpp:190
No locals.
#24 0x619ca3b0 in Mgr<PluginManager>::Free ()
    at F:/cbsource/src/include/manager.h:189
No locals.
#25 0x61888f4e in Manager::Shutdown () at F:/cbsource/src/sdk/manager.cpp:167
No locals.
#26 0x0043d35a in MainFrame::OnApplicationClose (this=0x18daaf0,
    event=@0x23ed94) at F:/cbsource/src/src/main.cpp:2611
        evt = {<> = {<No data fields>}, <BlockAllocated<CodeBlocksEvent,75u, fal
se>> = {static allocator = {
      allocBlocks = {<_Vector_base<BlockAllocator<CodeBlocksEvent, 75u,  false>:
:LinkedBlock<CodeBlocksEvent>*,std::allocator<BlockAllocator<CodeBlocksEvent, 75
u,  false>::LinkedBlock<CodeBlocksEvent>*> >> = {
          _M_impl = {<allocator<BlockAllocator<CodeBlocksEvent, 75u,  false>::Li
nkedBlock<CodeBlocksEvent>*>> = {<new_allocator<BlockAllocator<CodeBlocksEvent,
75u,  false>::LinkedBlock<CodeBlocksEvent>*>> = {<No data fields>}, <No data fie
lds>}, _M_start = 0x0, _M_finish = 0x0,
            _M_end_of_storage = 0x0}}, <No data fields>}, first = 0x0,
      ref_count = 0, max_refs = 0, total_refs = 0}}, m_pProject = 0x0,
  m_pEditor = 0x0, m_pPlugin = 0x0, m_X = 0, m_Y = 0,
  m_TargetName = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0x6d25425c}, <No data fields>},
  m_OldTargetName = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0x6d25425c}, <No data fields>}, static ms_classInfo = {
    m_className = 0x61a8ff64, m_objectSize = 84,
    m_objectConstructor = 0x6190fec8 <CodeBlocksEvent::wxCreateObject()>,
    m_baseInfo1 = 0x6d2f59a8, m_baseInfo2 = 0x0,
    static sm_first = 0x61aad7b8, m_next = 0x61aaddc0,
    static sm_classTable = 0x32e50}}
        prjman = (class ProjectManager *) 0x2059f78
        evtShutdown = {<> = {<No data fields>}, <BlockAllocated<CodeBlocksEvent,
75u, false>> = {static allocator = {
      allocBlocks = {<_Vector_base<BlockAllocator<CodeBlocksEvent, 75u,  false>:
:LinkedBlock<CodeBlocksEvent>*,std::allocator<BlockAllocator<CodeBlocksEvent, 75
u,  false>::LinkedBlock<CodeBlocksEvent>*> >> = {
          _M_impl = {<allocator<BlockAllocator<CodeBlocksEvent, 75u,  false>::Li
nkedBlock<CodeBlocksEvent>*>> = {<new_allocator<BlockAllocator<CodeBlocksEvent,
75u,  false>::LinkedBlock<CodeBlocksEvent>*>> = {<No data fields>}, <No data fie
lds>}, _M_start = 0x0, _M_finish = 0x0,
            _M_end_of_storage = 0x0}}, <No data fields>}, first = 0x0,
      ref_count = 0, max_refs = 0, total_refs = 0}}, m_pProject = 0x0,
  m_pEditor = 0x0, m_pPlugin = 0x0, m_X = 0, m_Y = 0,
  m_TargetName = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0x6d25425c}, <No data fields>},
  m_OldTargetName = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0x6d25425c}, <No data fields>}, static ms_classInfo = {
    m_className = 0x61a8ff64, m_objectSize = 84,
    m_objectConstructor = 0x6190fec8 <CodeBlocksEvent::wxCreateObject()>,
    m_baseInfo1 = 0x6d2f59a8, m_baseInfo2 = 0x0,
    static sm_first = 0x61aad7b8, m_next = 0x61aaddc0,
    static sm_classTable = 0x32e50}}
#27 0x6cd07305 in wxEvtHandler::ProcessEventIfMatches ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#28 0x6cd0765c in wxEventHashTable::HandleEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#29 0x6cd08629 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#30 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#31 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#32 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#33 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#34 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#35 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#36 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#37 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#38 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#39 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#40 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#41 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#42 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#43 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#44 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#45 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#46 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#47 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#48 0x6cd085c9 in wxEvtHandler::ProcessEvent ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#49 0x6ce8ffa3 in wxWindowBase::Close () from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#50 0x6cda3007 in wxFrame::MSWWindowProc ()
   from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#51 0x6cd72220 in wxWndProc () from C:\MinGW\Bin\wxmsw28u_gcc_cb.dll
No symbol table info available.
#52 0x7e418734 in USER32!GetDC () from C:\WINDOWS\system32\user32.dll
No symbol table info available.
#53 0x0026049e in ?? ()
No symbol table info available.
#54 0x00000010 in ?? ()
No symbol table info available.
#55 0x00000000 in ?? ()
No symbol table info available.
(gdb)
Be a part of the solution, not a part of the problem.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: SVN version 4475 crashes on exit
« Reply #3 on: September 18, 2007, 08:38:01 pm »
@Ceniza,

I've reverted the modification made to CC in revision 4473. That seems to fix this. Please feel free to re-revert it, in case a better solution is found. :)

Best Regards,

Biplab
Be a part of the solution, not a part of the problem.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: SVN version 4475 crashes on exit
« Reply #4 on: September 18, 2007, 08:39:33 pm »
My fault then, but I would call that a race condition. The fact that the semaphore is posted before Delete in Windows and after Delete in other platforms is also a sign of a problem. In Windows it seems the thread is able to set the pointer to NULL before that code checks for NULL, so Delete won't be called (either that or calling Delete doesn't cause a problem there (perhaps it's calling it while the thread is still running, but just before it dies)), but in *nix it'll try to overwrite a variable that may be no longer valid.

I'll try to reproduce it in Windows again (I tried already, but it didn't crash).

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: SVN version 4475 crashes on exit
« Reply #5 on: September 18, 2007, 08:45:42 pm »
I'll try to reproduce it in Windows again (I tried already, but it didn't crash).

I faced this crash a number of times. So I just reverted the codes that has been changed in between. Just try it for couple of times. :)
Be a part of the solution, not a part of the problem.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: SVN version 4475 crashes on exit
« Reply #6 on: September 18, 2007, 10:09:01 pm »
Don't worry, I set it to use only 1 CPU in VMware, and now it crashes :)

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: SVN version 4475 crashes on exit
« Reply #7 on: September 19, 2007, 12:08:03 am »
You know what... I'll just leave it like that. It seems to work most of the time in Windows, it's usable in *nix (even though I bet it's the cause of the many "Aborted" exits I get) and very few people are using this IDE in Mac (where this situation is even worse, making CC useless (yes, I've tried CB in Mac)).

Every single attempt I made to get something coherent in that piece of code that wouldn't be subject to race conditions fired a new crash somewhere else, because of another "race condition". I would try to redesign some of those pieces of code, but, once again, I don't have enough time now. In addition, modifying that code easily fires crashes under different situations in different platforms, so I won't touch it for now (at least it's usable like it is right now).

Offline ironhead

  • Almost regular
  • **
  • Posts: 210
Re: SVN version 4475 crashes on exit
« Reply #8 on: September 19, 2007, 04:56:55 am »
The 4478 build (which I assume contains the reverted code) works like a charm.

Thanx for the quick fix! :)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: SVN version 4475 crashes on exit
« Reply #9 on: September 19, 2007, 09:44:22 am »
Ceniza talked with me about this already, but I guess it's worth posting a note for everyone else again :)

Please do not tamper with any code only to make Valgrind [insert any other analysis tool] happy.
(print this in poster size and hang it over your bed)

While it is true that Valgrind [iaoat] may help you spot leaks and other errors, it is intrinsically stupid. It knows nothing about the programmer's intent or the program's normal mode of operation.
It may give a hint if you're looking for a problem. It may even give you a hint if you're just profiling the program to "clean up". Those hints may be very valuable, too.
However, output from a diagnosis tool must never be seen as a mandatory "must fix" issue. Often, those warnings or errors will be false positives, and if you "fix" the problem, you will break the program.

Now, about Code Completion and semaphores, I must admit that I've never understood the tampering that's being done there (especially not why it depends on the platform when a semaphore should signalled). Personally, I would have chosen a different design from the beginning, abstracting the whole thread stuff into a class that does that, and only that (as in FileManager, for example).
But whatever it is, the present implementation more or less works. So, unless someone is willing to rewrite that whole big ugly thing from scratch, I'd recommend to not touch it. Tampering with something one doesn't understand (and I assume none of us really understands) most often makes things worse.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."