Author Topic: CodeBlock crashes in Linux  (Read 5953 times)

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 125
CodeBlock crashes in Linux
« on: November 03, 2021, 03:11:40 pm »
For some time I keep seeing C::B crahes in Linux. Today I could now narrow it down to be quite reproducable on my system (I checked one PC and Laptop). I am using Build SVN12487 on Ubuntu 18.04LTS, gcc 7.4.0.

Here is the procedure to reproduce it:

Preparation:
1. Create a new Console Prokject with the default GCC.
2. Change the code to the following and save the project
Code
class CTest
{
    void foo();
    int nBar;
};

void CTest::foo() {
 }

main()
{
return 0;
}

1. Open the project. Select the Symbol Browser Tab and open CTest. It should show the function and the member variable
2. change: void CTest::foo()  -> int CTest::foo()
3. Ctrl-S to save.
4. Double click on the symbol browser tree on "foo()" or "nBar"
I observed one of the following behaviours
 a) ASSERT Window. The Backtrace includes "OnTreeDoubleClick". After the Assert windows I always get a crash with a few more clicks to various symbol tree items
 b) crash
 c) C:B hangs, so I have to kill the process.

I tried the same in the Windows version. There is no problem. I noted, that after saving the file in windows the tree is modified, this is missing in Linux. It seems that I can avoid the problem by re-parsing the tree every time.

Can someone please verify that on another system?


« Last Edit: November 09, 2021, 12:58:46 pm by tigerbeard »

Offline AndrewCot

  • Regular
  • ***
  • Posts: 314
Re: CodeBlock crashes in Linux
« Reply #1 on: November 03, 2021, 11:33:13 pm »
I followed the process as best I could and I did not get any crash. I would first suggest updating your C::B to the latest nightly build and try it.

My testing was done on the following:
    XUbuntui 20.04 (updated yesterday)
    C::B Nightly SVN-r12535 using wxWidgets 3.0.5

C::B help->about->information shows:

Name                   : Code::Blocks
Version                : svn-r12535
SDK Version            : 2.16.0
Scintilla Version      : 3.7.5
Author                 : The Code::Blocks Team
E-mail                 : info@codeblocks.org
Website                : http://www.codeblocks.org
OS                     : Linux 5.14.11-051411-generic x86_64
Scaling factor         : 1.000000
Detected scaling factor: 0.989583
Display PPI            : 96x95
Display count          : 1
Display 0              : XY=[0,0]; Size=[1920,975]; Primary

wxWidgets Library (wxGTK port)
Version 3.0.5 (Unicode: wchar_t, debug level: 1),
Runtime version of toolkit used is 3.24.
Compile-time GTK+ version is 3.24.20.

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 125
Re: CodeBlock crashes in Linux
« Reply #2 on: November 04, 2021, 12:56:02 am »
Thanks for testing.
Great new news that it seems to be a local item here.
Seems like I have an older Linux version 4.15.0 and also an older GTK 2.24.32 and runtime toolkit 2.24. 

I will check the same build you are using.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 910
Re: CodeBlock crashes in Linux
« Reply #3 on: November 04, 2021, 12:01:22 pm »
Quote
I noted, that after saving the file in windows the tree is modified, this is missing in Linux.

That is selectable, look for Update parser when typing (on save otherwise) in Settings -> Editor -> Code Completion. Checking the option will increase CPU consumption, though.

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 125
Re: CodeBlock crashes in Linux
« Reply #4 on: November 04, 2021, 08:30:00 pm »
I compiled the 12535, current nightly.  Same behavior. I tested both checked and unchecked at  "Update parser when typing (on save otherwise)" in Settings -> Editor -> Code Completion.

Could that be to GTK2? For compiling I used the system repository dependencies, i.e.

Code
 sudo apt install libwxgtk3.0-dev libboost-system-dev fakeroot debhelper cdbs libgtk2.0-dev libgamin-dev libboost-dev libhunspell-dev

and then
Code
./bootstrap
./debian/setup_control.sh
dpkg-buildpackage -us -uc

The resulting debfiles I installed with
Code
dpkg -i *.deb

Here is the system Info.
Name                   : Code::Blocks
Version                : svn-r12535
SDK Version            : 2.16.0
Scintilla Version      : 3.7.5
Author                 : The Code::Blocks Team
E-mail                 : info@codeblocks.org
Website                : http://www.codeblocks.org
OS                     : Linux 4.15.0-159-generic x86_64
Scaling factor         : 1,000000
Detected scaling factor: 0,989583
Display PPI            : 96x95
Display count          : 1
Display 0              : XY=[0,0]; Size=[1920,1080]; Primary

wxWidgets Library (wxGTK port)
Version 3.0.4 (Unicode: wchar_t, debug level: 1),
Runtime version of toolkit used is 2.24.
Compile-time GTK+ version is 2.24.32.

Offline AndrewCot

  • Regular
  • ***
  • Posts: 314
Re: CodeBlock crashes in Linux
« Reply #5 on: November 05, 2021, 01:29:36 am »
Sorry, but when I said try the latest nightly I meant download the pre built deb files or setup the PPA and try them, not build from source code.

If you run C::B (debug run) that you built from within C::B try to see if the crash causes GDB to break and then you can check the call stack and copy it and post it as it will help narrow where the problem is and could give someone (probably not me as I am not familiar with GTK or wxWidgets) hint as to where to look next or where the issue may be.

To build withing C::B load the src/CodeBlocks_wx30-unix.workspace file and build it. You  may need to setup some C::B global variables if they are not allready configured.

If there is a codeblocks.RPT crash report file generated when C::B crashes can you post this.


Offline tigerbeard

  • Almost regular
  • **
  • Posts: 125
Re: CodeBlock crashes in Linux
« Reply #6 on: November 08, 2021, 01:54:05 pm »
Quote
download the pre built deb files or setup the PPA and try them, not build from source code.

I uninstalled my compiled version and installed Xaviou's pre-built release ref 12535 and got the same crashes.
The file attached has the XMLinfo from the crash window, the end has the call stack.

Offline AndrewCot

  • Regular
  • ***
  • Posts: 314
Re: CodeBlock crashes in Linux
« Reply #7 on: November 09, 2021, 12:50:07 am »
I was able to reproduce a crash only after I changed the Update parser when typing (on save otherwise) in Settings -> Editor -> Code Completion as indicated in Miguel's post above when it was disabled.

Can you create a new C::B bug ticket via the https://sourceforge.net/p/codeblocks/tickets/ page so it does not get lost.




Offline AndrewCot

  • Regular
  • ***
  • Posts: 314
Re: CodeBlock crashes in Linux
« Reply #8 on: November 09, 2021, 05:10:06 am »
Below is the call stack I get when C::B crashes when debugging the locally built C::B debugging. This fills in the missing functions along with filenames compared to to the non debug crash version info.


#0 0x7fffe1fc147e   BasicSearchTree::GetString(SearchTreePoint const&, unsigned long) const(this=0x7fffc0075590, nn=..., top=0) (/home/ubuntu/code/codeblocks/gtk3-unicode-3.0/build/AC-WindowsInstaller/src/plugins/codecompletion/parser/searchtree.cpp:567)
#1 0x7fffe1fc13fe   BasicSearchTree::GetString(unsigned long) const(this=0x7fffc0075590, n=1) (/home/ubuntu/code/codeblocks/gtk3-unicode-3.0/build/AC-WindowsInstaller/src/plugins/codecompletion/parser/searchtree.cpp:560)
#2 0x7fffe1fd8a27   TokenTree::GetFilename(unsigned long) const(this=0x7fffc0075450, fileIdx=1) (/home/ubuntu/code/codeblocks/gtk3-unicode-3.0/build/AC-WindowsInstaller/src/plugins/codecompletion/parser/tokentree.cpp:870)
#3 0x7fffe1fcc024   Token::GetFilename() const(this=0x7fffc0034390) (/home/ubuntu/code/codeblocks/gtk3-unicode-3.0/build/AC-WindowsInstaller/src/plugins/codecompletion/parser/token.cpp:189)
#4 0x7fffe1ef05d6   ClassBrowser::OnTreeItemDoubleClick(wxTreeEvent&) (this=0x555557625070, event=...) (/home/ubuntu/code/codeblocks/gtk3-unicode-3.0/build/AC-WindowsInstaller/src/plugins/codecompletion/classbrowser.cpp:598)
#5 0x7ffff7295641   wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#6 0x7ffff7295743   wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#7 0x7ffff7295aa0   wxEvtHandler::TryHereOnly(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#8 0x7ffff7295b2b   wxEvtHandler::ProcessEventLocally(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#9 0x7ffff7295bd1   wxEvtHandler::ProcessEvent(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#10 0x7ffff7812f2a   wxWindowBase::TryAfter(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0:??)
#11 0x7ffff7812f2a   wxWindowBase::TryAfter(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0:??)
#12 0x7ffff7812f2a   wxWindowBase::TryAfter(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0:??)
#13 0x7ffff787c002   wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0:??)
#14 0x7ffff78944a2   wxGenericTreeCtrl::OnMouse(wxMouseEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0:??)
#15 0x7ffff7295641   wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#16 0x7ffff7295743   wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#17 0x7ffff7295aa0   wxEvtHandler::TryHereOnly(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#18 0x7ffff7295b2b   wxEvtHandler::ProcessEventLocally(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#19 0x7ffff7295bd1   wxEvtHandler::ProcessEvent(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#20 0x7ffff787c002   wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0:??)
#21 0x7ffff729595b   wxEvtHandler::SafelyProcessEvent(wxEvent&) () (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0:??)
#22 0x7ffff764f82e    () at /usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0 (/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0:??)
#23 0x7ffff5bb34fb    () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0:??)
#24 0x7ffff567b802   g_closure_invoke() (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0:??)
#25 0x7ffff568f814    () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0:??)
#26 0x7ffff569a47d   g_signal_emit_valist() (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0:??)
#27 0x7ffff569b0f3   g_signal_emit() (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0:??)
#28 0x7ffff5b5dc23    () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0:??)
#29 0x7ffff5a19128    () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0:??)

Hope this is of some use to the other C::B devs to investigate as I will not have time to look at this for a while.

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 125
Re: CodeBlock crashes in Linux
« Reply #9 on: November 09, 2021, 10:23:52 am »
@AndrewCot thank you for the debug test.

this is the ticket
C::B crashes in Linux in a minimal HelloWorld program