Author Topic: Weird crash - CC  (Read 21716 times)

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Weird crash - CC
« on: February 15, 2010, 04:51:36 pm »
Hi All,

I'm experiencing a weird crash with new CC. Build configuration is as follows-
OS - Win 7 64 bit
Revision no: 6165 (As of writing) + 64 bit patches.
wx version: 2.9

Cause of crash: When I open a new project, C::B cpu usage reaches a real high (hogging almost 100% in each core). Memory usage keeps on increasing. Finally after some time C::B dies.

The backtrace I got is really weird. There are over 8000 stackframes (as of last count). I'm posting first 20. Remaining stack frames are similar.
Quote
GNU gdb (GDB) 7.0.50.20100202
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from D:\cbsource\branches\trunk\src\devel/codeblocks.exe...done.

(gdb) r
Starting program: D:\cbsource\branches\trunk\src\devel/codeblocks.exe
[New Thread 5736.0x1738]
Error while mapping shared library sections:
`D:\cbsource\branches\trunk\src\devel\exchndl.dll': not in executable format: Fi
le format not recognized
Error while mapping shared library sections:
`D:\cbsource\branches\trunk\src\devel\exchndl.dll': not in executable format: Fi
le format not recognized
[New Thread 5736.0xd78]
[New Thread 5736.0x764]
[New Thread 5736.0x1454]
[New Thread 5736.0x1494]
[New Thread 5736.0x9ac]
[New Thread 5736.0x688]
[New Thread 5736.0x15a8]
[New Thread 5736.0x1170]
[New Thread 5736.0xc08]
[New Thread 5736.0x1420]
[New Thread 5736.0x8a4]
[New Thread 5736.0xeb4]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 5736.0x8a4]
0x000000006a24100f in wxBaseArrayPtrVoid::operator[] (this=0x62abd08,
    uiIndex=0) at ../../include/wx/dynarray.h:829
829     WX_DECLARE_USER_EXPORTED_BASEARRAY(const void *, wxBaseArrayPtrVoid,
(gdb) bt 20
#0  0x000000006a24100f in wxBaseArrayPtrVoid::operator[] (this=0x62abd08,
    uiIndex=0) at ../../include/wx/dynarray.h:829
#1  0x000000006a24f13c in wxEventTableEntryPointerArray::operator[] (
    this=0x62abd08, uiIndex=0) at ../../include/wx/event.h:2778
#2  0x0000000069873ac2 in wxEventHashTable::HandleEvent (this=0x65f8e6c0,
    event=..., self=0x61e2ac0) at ../../src/common/event.cpp:920
#3  0x00000000698761cf in wxEvtHandler::ProcessEventHere (this=0x61e2ac0,
    event=...) at ../../src/common/event.cpp:1381
#4  0x00000000698760c3 in wxEvtHandler::ProcessEvent (this=0x61e2ac0,
    event=...) at ../../src/common/event.cpp:1352
#5  0x0000000069b2e7df in wxWindowBase::TryAfter (this=0x62a8600, event=...)
    at ../../src/common/wincmn.cpp:2902
#6  0x000000006987611a in wxEvtHandler::ProcessEvent (this=0x62a8600,
    event=...) at ../../src/common/event.cpp:1363
#7  0x0000000069b2e7df in wxWindowBase::TryAfter (this=0x6194d60, event=...)
    at ../../src/common/wincmn.cpp:2902
#8  0x000000006987611a in wxEvtHandler::ProcessEvent (this=0x6194d60,
    event=...) at ../../src/common/event.cpp:1363
#9  0x0000000069b2e7df in wxWindowBase::TryAfter (this=0x6195840, event=...)
    at ../../src/common/wincmn.cpp:2902
#10 0x000000006987611a in wxEvtHandler::ProcessEvent (this=0x6195840,
    event=...) at ../../src/common/event.cpp:1363
#11 0x00000000698762c0 in wxEvtHandler::SafelyProcessEvent (this=0x6195840,
    event=...) at ../../src/common/event.cpp:1394
#12 0x0000000069b26c13 in wxWindowBase::HandleWindowEvent (this=0x6195840,
    event=...) at ../../src/common/wincmn.cpp:1240
#13 0x00000000699eb824 in wxTreeCtrl::HandleTreeEvent (this=0x6195840,
    event=...) at ../../src/msw/treectrl.cpp:1088
#14 0x000000006a225548 in wxTreeCtrl::IsTreeEventAllowed (this=0x6195840,
    event=...) at ../../include/wx/msw/treectrl.h:244
#15 0x00000000699eee41 in wxTreeCtrl::DoExpand (this=0x6195840, item=...,
    flag=32769) at ../../src/msw/treectrl.cpp:1762
#16 0x00000000699ef118 in wxTreeCtrl::CollapseAndReset (this=0x6195840,
    item=...) at ../../src/msw/treectrl.cpp:1789
#17 0x0000000065ebbab9 in ClassBrowserBuilderThread::CollapseItem (
    this=0x64f0170, item=..., useLock=true)
    at D:\cbsource\branches\trunk\src\plugins\codecompletion\classbrowserbuilder
thread.cpp:1027
#18 0x0000000065eb28ea in ClassBrowser::OnTreeItemCollapsing (this=0x61e2ac0,
    event=...)
    at D:\cbsource\branches\trunk\src\plugins\codecompletion\classbrowser.cpp:75
4
#19 0x00000000697041ce in wxAppConsoleBase::HandleEvent (this=0x1246650,
    handler=0x61e2ac0, func=Cannot access memory at address 0x0
) at ../../src/common/appbase.cpp:497
(More stack frames follow...)

Has anyone else experienced this crash?
Be a part of the solution, not a part of the problem.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Weird crash - CC
« Reply #1 on: February 16, 2010, 10:43:15 pm »
I've not seen this crash, but witnessed another deadlock/crash

Code
#0  0x00007fa41c474104 in __lll_lock_wait () from /lib/libpthread.so.0
#1  0x00007fa41c46fb11 in _L_lock_52 () from /lib/libpthread.so.0
#2  0x00007fa41c46f42c in pthread_mutex_lock () from /lib/libpthread.so.0
#3  0x00007fa41c7726e9 in wxMutexInternal::Lock() () from /usr/lib/libwx_baseu-2.8.so.0
#4  0x00007fa40b714ff9 in Parser::FindTokensInFile(wxString const&, std::set<int, std::less<int>, std::allocator<int> >&, short) () from /usr/lib/codeblocks/plugins/libcodecompletion.so
#5  0x00007fa40b6fe327 in CodeCompletion::ParseFunctionsAndFillToolbar(bool) () from /usr/lib/codeblocks/plugins/libcodecompletion.so
#6  0x00007fa40b6feba0 in CodeCompletion::OnEditorActivated(CodeBlocksEvent&) () from /usr/lib/codeblocks/plugins/libcodecompletion.so
#7  0x00007fa41e64f9c9 in Manager::ProcessEvent(CodeBlocksEvent&) () from /usr/lib/libcodeblocks.so.0
#8  0x00007fa41e612a4a in EditorManager::OnPageChanged(wxAuiNotebookEvent&) () from /usr/lib/libcodeblocks.so.0
#9  0x00007fa41c7748e1 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0
#10 0x00007fa41c7758b3 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /usr/lib/libwx_baseu-2.8.so.0
#11 0x00007fa41c775997 in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0
#12 0x00007fa41c775920 in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0

I've not been able to reproduce it, probably because it is a strange timing bug...
But what I've done was:
1. I've opened the Contrib-unix.workspace
2. C::B opened some previously opened files (in ThreadSearch and wxSmith)
3. I've started to close them with Ctrl+W (probably too fast)
4. The gui got grey.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Weird crash - CC
« Reply #2 on: February 17, 2010, 06:38:14 am »
Has anyone else experienced this crash?

I've not seen this crash, but witnessed another deadlock/crash

I haven' experienced any of these. However, I am not using a 64 bit OS nor Linux. In fact CC runs for me very stable at present. Most stable ever to be honest.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Weird crash - CC
« Reply #3 on: February 17, 2010, 09:43:32 am »
Has anyone else experienced this crash?

I've not seen this crash, but witnessed another deadlock/crash

I haven' experienced any of these. However, I am not using a 64 bit OS nor Linux. In fact CC runs for me very stable at present. Most stable ever to be honest.

Honestly speaking CC has improved. But the improvement came with an annoyance. C::B freezes for 5-10 seconds or even more when I open a new project. I hope others have noticed this too.
Be a part of the solution, not a part of the problem.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Weird crash - CC
« Reply #4 on: February 17, 2010, 09:46:15 am »
I hope others have noticed this too.
Well - that's because CC find around 5 times the tokens as before. But you may want to setup the scope for the symbols differently (e.g. not "all", but "project only").
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Weird crash - CC
« Reply #5 on: February 17, 2010, 09:49:36 am »
I hope others have noticed this too.
Well - that's because CC find around 5 times the tokens as before. But you may want to setup the scope for the symbols differently (e.g. not "all", but "project only").

My point is that this shouldn't come at the cost of user experience. If needed, we should lower the thread priority or do the needful so that CC leaves some cpu time for ui processing.
Be a part of the solution, not a part of the problem.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Weird crash - CC
« Reply #6 on: February 17, 2010, 01:31:11 pm »
My point is that this shouldn't come at the cost of user experience. If needed, we should lower the thread priority or do the needful so that CC leaves some cpu time for ui processing.
Yes - we had discussed this already (somewhere?!). Someone proposed doing the UI update (of the symbols tree) in an own thread, rather than calling it "directly".
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Weird crash - CC
« Reply #7 on: December 14, 2010, 08:53:39 am »
This issue still existed in wx-2.9.2svn.
It's seems occured in wx-svn59336.

Quote
VZ  2009/3/5 22:13:19             
fix multiple problems with selection in controls with wxTR_MULTIPLE style (closes #626)

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Weird crash - CC
« Reply #8 on: December 14, 2010, 09:22:15 am »
This is an endloop in wx.
OnTreeItemCollapsing -> CollapseAndReset -> IsTreeEventAllowed -> HandleTreeEvent -> OnTreeItemCollapsing  ...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Weird crash - CC
« Reply #9 on: December 14, 2010, 09:27:33 am »
This is an endloop in wx.
You mean infinite loop?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Weird crash - CC
« Reply #10 on: December 14, 2010, 09:33:10 am »
This is an endloop in wx.
You mean infinite loop?
Yes, It's infinite loop.
« Last Edit: December 14, 2010, 09:36:01 am by Loaden »

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Weird crash - CC
« Reply #11 on: December 14, 2010, 09:44:21 am »
This patch can fix this issue, but I do not know if there is any side effects.
Code
Index: src/msw/treectrl.cpp
===================================================================
--- src/msw/treectrl.cpp (revision 66360)
+++ src/msw/treectrl.cpp (working copy)
@@ -1770,15 +1770,6 @@
     tvItem.state = 0;
     DoSetItem(&tvItem);
 
-    if ( IsExpanded(item) )
-    {
-        wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_COLLAPSING,
-                          this, wxTreeItemId(item));
-
-        if ( !IsTreeEventAllowed(event) )
-            return;
-    }
-
     if ( TreeView_Expand(GetHwnd(), HITEM(item), flag) )
     {
         if ( IsExpanded(item) )

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Weird crash - CC
« Reply #12 on: December 14, 2010, 09:49:57 am »
OnTreeItemCollapsing -> CollapseAndReset -> IsTreeEventAllowed -> HandleTreeEvent -> OnTreeItemCollapsing  ...
If that is the case, you should definitely report this to the WX guys.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Weird crash - CC
« Reply #13 on: December 14, 2010, 09:54:34 am »
OnTreeItemCollapsing -> CollapseAndReset -> IsTreeEventAllowed -> HandleTreeEvent -> OnTreeItemCollapsing  ...
If that is the case, you should definitely report this to the WX guys.
done. :)
http://trac.wxwidgets.org/ticket/12774

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Weird crash - CC
« Reply #14 on: December 14, 2010, 04:20:54 pm »
OnTreeItemCollapsing -> CollapseAndReset -> IsTreeEventAllowed -> HandleTreeEvent -> OnTreeItemCollapsing  ...
If that is the case, you should definitely report this to the WX guys.
done. :)
http://trac.wxwidgets.org/ticket/12774

Great Job! :)

I'll test over the weekend (or earlier if I can find time) and post feedback.
Be a part of the solution, not a part of the problem.