Author Topic: Code::Blocks crashes during project reload  (Read 6143 times)

Offline alexchen

  • Multiple posting newcomer
  • *
  • Posts: 84
Code::Blocks crashes during project reload
« on: January 25, 2019, 07:54:23 pm »
I am using version 17.12 on CentOS 7.5  I encounter a crash when several project files, i.e. *.cbp, are modified externally via a editor and Code::Blocks offers to reload these projects.
This is the stack trace from the dump file:
===============
$ gdb /usr/bin/codeblocks /var/crash/codeblocks.crash
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7
Copyright (C) 2013 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/codeblocks...Reading symbols from /usr/bin/codeblocks...(no debugging symbols found)...done.
(no debugging symbols found)...done.
[New LWP 57762]
[New LWP 58025]
[New LWP 57778]
[New LWP 57813]
[New LWP 32592]
[New LWP 57930]
[New LWP 32591]
[New LWP 57822]
[New LWP 32590]
[New LWP 32593]
[New LWP 57812]
[New LWP 57811]
[New LWP 57780]
[New LWP 32589]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `codeblocks'.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000000000000 in ?? ()
Missing separate debuginfos, use: debuginfo-install codeblocks-17.12-1.el7.centos.x86_64
(gdb) where
#0  0x0000000000000000 in  ()
#1  0x00007ff2b89f980c in ProjectManager::AddProjectDependency(cbProject*, cbProject*) () at /lib64/libcodeblocks.so.0
#2  0x00007ff2b89faf5e in ProjectManager::ReloadProject(cbProject*) () at /lib64/libcodeblocks.so.0
#3  0x00000000004cc745 in ProjectManagerUI::CheckForExternallyModifiedProjects() ()
#4  0x00000000004448e8 in CodeBlocksApp::OnAppActivate(wxActivateEvent&) ()
#5  0x00007ff2b6485746 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#6  0x00007ff2b64857eb in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () at /lib64/libwx_baseu-2.8.so.0
#7  0x00007ff2b6485b57 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#8  0x00007ff2b6d9d128 in wxAppBase::SetActive(bool, wxWindow*) () at /lib64/libwx_gtk2u_core-2.8.so.0
#9  0x00007ff2b6d78399 in wxFrame::OnInternalIdle() () at /lib64/libwx_gtk2u_core-2.8.so.0
#10 0x00007ff2b6d9d19f in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) () at /lib64/libwx_gtk2u_core-2.8.so.0
#11 0x00007ff2b6d9d654 in wxAppBase::ProcessIdle() () at /lib64/libwx_gtk2u_core-2.8.so.0
#12 0x00007ff2b6d134b1 in wxapp_idle_callback () at /lib64/libwx_gtk2u_core-2.8.so.0
#13 0x00007ff2b4178557 in g_idle_dispatch () at /lib64/libglib-2.0.so.0
#14 0x00007ff2b417b969 in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#15 0x00007ff2b417bcc8 in g_main_context_iterate.isra.22 () at /lib64/libglib-2.0.so.0
#16 0x00007ff2b417bf9a in g_main_loop_run () at /lib64/libglib-2.0.so.0
#17 0x00007ff2b5e57247 in gtk_main () at /lib64/libgtk-x11-2.0.so.0
#18 0x00007ff2b6d2718a in wxEventLoop::Run() () at /lib64/libwx_gtk2u_core-2.8.so.0
#19 0x00007ff2b6d9d3eb in wxAppBase::MainLoop() () at /lib64/libwx_gtk2u_core-2.8.so.0
#20 0x0000000000449fb0 in CodeBlocksApp::OnRun() ()
#21 0x00007ff2b642e75d in wxEntry(int&, wchar_t**) () at /lib64/libwx_baseu-2.8.so.0
#22 0x0000000000436ee2 in main ()
(gdb) info threads
  Id   Target Id         Frame
  14   Thread 0x7ff27d87e700 (LWP 32589) 0x00007ff2b3c7a995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  13   Thread 0x7ff2a0e30700 (LWP 57780) 0x00007ff2b2f71f0d in poll () from /lib64/libc.so.6
  12   Thread 0x7ff29affd700 (LWP 57811) 0x00007ff2b3c7a995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  11   Thread 0x7ff29a7fc700 (LWP 57812) 0x00007ff2b3c7a995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  10   Thread 0x7ff27dc80700 (LWP 32593) 0x00007ff2b3c7a995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  9    Thread 0x7ff27d67d700 (LWP 32590) 0x00007ff2b3c7a995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  8    Thread 0x7ff298a19700 (LWP 57822) 0x00007ff2b3c7a995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  7    Thread 0x7ff29b7fe700 (LWP 32591) 0x00007ff2b3c7a995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  6    Thread 0x7ff29bfff700 (LWP 57930) 0x00007ff2b3c7d51d in __lll_lock_wait () from /lib64/libpthread.so.0
  5    Thread 0x7ff27ec82700 (LWP 32592) 0x00007ff2b3c7a995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  4    Thread 0x7ff299ffb700 (LWP 57813) 0x00007ff2b3c7a995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  3    Thread 0x7ff2a1631700 (LWP 57778) 0x00007ff2b2f71f0d in poll () from /lib64/libc.so.6
  2    Thread 0x7ff27f483700 (LWP 58025) 0x00007ff2b2f73c73 in select () from /lib64/libc.so.6
* 1    Thread 0x7ff2b91a4a40 (LWP 57762) 0x0000000000000000 in ?? ()
==========
It seems to me that the ProjectManager object has been deleted when the call happens.
It would be nice to build Code::Blocks with '-g' flag in projection build so that the line numbers are included in the dump file to facilitate crash analysis. (It can co-exist with the optimization flag, e.g. -O3)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Code::Blocks crashes during project reload
« Reply #1 on: January 25, 2019, 10:34:58 pm »
You can build codeblocks quite easy by yourself, with the benefit to have the latest code, because 17.12 is quite old and there were tons of bugfixes...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::Blocks crashes during project reload
« Reply #2 on: January 26, 2019, 12:54:37 am »
This particular one is fixed in trunk...
(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 alexchen

  • Multiple posting newcomer
  • *
  • Posts: 84
Re: Code::Blocks crashes during project reload
« Reply #3 on: January 29, 2019, 03:05:33 am »
I downloaded the source code from trunk and the README file still still says "This is the Code::Blocks IDE version 17.12'.  Is it the latest copy?
I encountered another crash today.  It seems like a different issue.
I use Code::Blocks within my build script for multiple workspaces to build a RPM.
Do not know if the crash is a problem in libwx_baseu-2.8 or Code::Blocks.

=========
$ gdb /usr/bin/codeblocks /var/crash/codeblocks.crash
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7
....
[New LWP 56248]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/bin/codeblocks --no-splash-screen --no-ipc --debug-log --build --target=Release64'.
Program terminated with signal 6, Aborted.
#0  0x00007f8e3f505277 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install codeblocks-17.12-1.el7.centos.x86_64
(gdb) where
#0  0x00007f8e3f505277 in raise () at /lib64/libc.so.6
#1  0x00007f8e3f506968 in abort () at /lib64/libc.so.6
#2  0x00007f8e3f547d37 in __libc_message () at /lib64/libc.so.6
#3  0x00007f8e3f54fda7 in malloc_consolidate () at /lib64/libc.so.6
#4  0x00007f8e3f551275 in _int_malloc () at /lib64/libc.so.6
#5  0x00007f8e3f55484c in malloc () at /lib64/libc.so.6
#6  0x00007f8e42a9d6d7 in wxStringBase::AllocBuffer(unsigned long) () at /lib64/libwx_baseu-2.8.so.0
#7  0x00007f8e42a9d866 in wxStringBase::AllocBeforeWrite(unsigned long) () at /lib64/libwx_baseu-2.8.so.0
#8  0x00007f8e42a9f7f9 in wxString::GetWriteBuf(unsigned long) () at /lib64/libwx_baseu-2.8.so.0
#9  0x00007f8e42aa0e57 in wxString::PrintfV(wchar_t const*, __va_list_tag*) () at /lib64/libwx_baseu-2.8.so.0
#10 0x00007f8e42aa103b in wxString::FormatV(wchar_t const*, __va_list_tag*) () at /lib64/libwx_baseu-2.8.so.0
#11 0x000000000044afa2 in F(wchar_t const*, ...) ()
#12 0x00007f8e4504a287 in ProjectManager::RemoveProjectFromAllDependencies(cbProject*) () at /lib64/libcodeblocks.so.0
#13 0x00007f8e4504ab9c in ProjectManager::CloseProject(cbProject*, bool, bool) () at /lib64/libcodeblocks.so.0
#14 0x00007f8e4504ae96 in ProjectManager::CloseAllProjects(bool) () at /lib64/libcodeblocks.so.0
#15 0x00007f8e4504b021 in ProjectManager::CloseWorkspace() () at /lib64/libcodeblocks.so.0
#16 0x00000000004a7c1a in MainFrame::OnApplicationClose(wxCloseEvent&) ()
#17 0x00007f8e42ad6746 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () at  lib64/libwx_baseu-2.8.so.0
#18 0x00007f8e42ad67eb in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () at /lib64/libwx_baseu-2.8.so.0
#19 0x00007f8e42ad6b57 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#20 0x00007f8e42ad6ae0 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#21 0x00007f8e42ad6ae0 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#22 0x00007f8e42ad6ae0 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#23 0x00007f8e42ad6ae0 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#24 0x00007f8e42ad6ae0 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#25 0x00007f8e42ad6ae0 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#26 0x00007f8e42ad6ae0 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#27 0x00007f8e42ad6ae0 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-2.8.so.0
#28 0x00007f8e434606fc in wxWindowBase::Close(bool) () at /lib64/libwx_gtk2u_core-2.8.so.0
#29 0x000000000044948e in CodeBlocksApp::OnInit() ()
#30 0x00007f8e42a7f74c in wxEntry(int&, wchar_t**) () at /lib64/libwx_baseu-2.8.so.0
#31 0x0000000000436ee2 in main ()
(gdb) info threads
  Id   Target Id         Frame
  7    Thread 0x7f8e26ffd700 (LWP 56248) 0x00007f8e402cb995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  6    Thread 0x7f8e267fc700 (LWP 56249) 0x00007f8e402cb995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  5    Thread 0x7f8e277fe700 (LWP 56247) 0x00007f8e402cb995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  4    Thread 0x7f8e2de95700 (LWP 56165) 0x00007f8e3f5c2f0d in poll () from /lib64/libc.so.6
  3    Thread 0x7f8e2d694700 (LWP 56166) 0x00007f8e3f5c2f0d in poll () from /lib64/libc.so.6
  2    Thread 0x7f8e2ce93700 (LWP 56167) 0x00007f8e3f5c7ec9 in syscall () from /lib64/libc.so.6
* 1    Thread 0x7f8e457f5a40 (LWP 56163) 0x00007f8e3f505277 in raise () from /lib64/libc.so.6
(gdb) thread 2
[Switching to thread 2 (Thread 0x7f8e2ce93700 (LWP 56167))]
#0  0x00007f8e3f5c7ec9 in syscall () from /lib64/libc.so.6
(gdb) where
#0  0x00007f8e3f5c7ec9 in syscall () at /lib64/libc.so.6
#1  0x00007f8e4081164e in g_cond_wait_until () at /lib64/libglib-2.0.so.0
#2  0x00007f8e407a1a21 in g_async_queue_pop_intern_unlocked () at /lib64/libglib-2.0.so.0
#3  0x00007f8e407a1fdb in g_async_queue_timeout_pop () at /lib64/libglib-2.0.so.0
#4  0x00007f8e407f43cc in g_thread_pool_thread_proxy () at /lib64/libglib-2.0.so.0
#5  0x00007f8e407f3970 in g_thread_proxy () at /lib64/libglib-2.0.so.0
#6  0x00007f8e402c7e25 in start_thread () at /lib64/libpthread.so.0
#7  0x00007f8e3f5cdbad in clone () at /lib64/libc.so.6
(gdb) thread 3
[Switching to thread 3 (Thread 0x7f8e2d694700 (LWP 56166))]
#0  0x00007f8e3f5c2f0d in poll () from /lib64/libc.so.6
(gdb) where
#0  0x00007f8e3f5c2f0d in poll () at /lib64/libc.so.6
#1  0x00007f8e407ccc4c in g_main_context_iterate.isra.22 () at /lib64/libglib-2.0.so.0
#2  0x00007f8e407ccf9a in g_main_loop_run () at /lib64/libglib-2.0.so.0
#3  0x00007f8e41bafbe6 in gdbus_shared_thread_func () at /lib64/libgio-2.0.so.0
#4  0x00007f8e407f3970 in g_thread_proxy () at /lib64/libglib-2.0.so.0
#5  0x00007f8e402c7e25 in start_thread () at /lib64/libpthread.so.0
#6  0x00007f8e3f5cdbad in clone () at /lib64/libc.so.6
(gdb) thread 4
[Switching to thread 4 (Thread 0x7f8e2de95700 (LWP 56165))]
#0  0x00007f8e3f5c2f0d in poll () from /lib64/libc.so.6
(gdb) where
#0  0x00007f8e3f5c2f0d in poll () at /lib64/libc.so.6
#1  0x00007f8e407ccc4c in g_main_context_iterate.isra.22 () at /lib64/libglib-2.0.so.0
#2  0x00007f8e407ccd7c in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#3  0x00007f8e407ccdb9 in glib_worker_main () at /lib64/libglib-2.0.so.0
#4  0x00007f8e407f3970 in g_thread_proxy () at /lib64/libglib-2.0.so.0
#5  0x00007f8e402c7e25 in start_thread () at /lib64/libpthread.so.0
#6  0x00007f8e3f5cdbad in clone () at /lib64/libc.so.6

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::Blocks crashes during project reload
« Reply #4 on: January 29, 2019, 08:34:53 am »
I downloaded the source code from trunk and the README file still still says "This is the Code::Blocks IDE version 17.12'.  Is it the latest copy?
Yes, it is the latest version. We've not made a release, so we've not changed the version number.

I encountered another crash today.  It seems like a different issue.
Is this with the new version? How have you built/installed it?

I use Code::Blocks within my build script for multiple workspaces to build a RPM.
What do you mean by this?

p.s. Please use code or quote tags when pasting long texts!
(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 alexchen

  • Multiple posting newcomer
  • *
  • Posts: 84
Re: Code::Blocks crashes during project reload
« Reply #5 on: January 29, 2019, 09:11:18 pm »
I have not built the source code yet.  I am using the prebuilt one from the download site, therefore the crash is from the original build.
From the stack dump, the problem is either in Code::Blocks' use of wxGTK API or wxGTK's own issue. 
If it is an issue in wxGTK, which is pretty old, maybe the it is fixed in wxGTK3? My CentOS 7 has wxGTK (2.8.12) installed (via Code::Blocks' dependency) and wxGTK3 (3.0.2) available.

What I am trying to says is that my build script invokes Code::Blocks command line multiple times for various workspace during the build. 
The crash always happens in one of the last few invocations during the process, but not necessarily in the same workspace.
I do not know if the repeated process of bringing up Code::Blocks via command line has any bearing to the symptom.


I just tried to build from the source by running the bootstrap command via the instructions in BUILD and got the following errors:
[fmserver@181x101 trunk]$ ./bootstrap
Using 'svn --xml info' to get the revision
Found revision: '11558' '2019-01-24 14:28:36'
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:141: warning: macro 'AM_OPTIONS_WXCONFIG' not found in library
configure.ac:142: warning: macro 'AM_PATH_WXCONFIG' not found in library
configure.ac:39: installing './compile'
configure.ac:7: installing './config.guess'
configure.ac:7: installing './config.sub'
configure.ac:22: installing './install-sh'
configure.ac:22: installing './missing'
src/base/tinyxml/Makefile.am: installing './depcomp'
configure.ac:141: error: possibly undefined macro: AM_OPTIONS_WXCONFIG
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:142: error: possibly undefined macro: AM_PATH_WXCONFIG
[
« Last Edit: January 29, 2019, 09:15:36 pm by alexchen »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::Blocks crashes during project reload
« Reply #6 on: January 29, 2019, 10:41:40 pm »
The bug is in C::B. You need to install the wxgtk-devel package. I'm using wxgtk 2.8.12 on centos7 and it works fine...

Here is a discussion of a similar problem:
http://forums.codeblocks.org/index.php/topic,23072.msg157018.html#msg157018
(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 alexchen

  • Multiple posting newcomer
  • *
  • Posts: 84
Re: Code::Blocks crashes during project reload
« Reply #7 on: January 29, 2019, 10:56:30 pm »
Is it a known bug if it is in C::B?  It is the same bug you fixed in the beginning of the history?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::Blocks crashes during project reload
« Reply #8 on: January 29, 2019, 11:02:25 pm »
Probably it is the same bug. When you build the trunk version and you test it we will know for sure.
(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 alexchen

  • Multiple posting newcomer
  • *
  • Posts: 84
Re: Code::Blocks crashes during project reload
« Reply #9 on: January 30, 2019, 03:16:55 am »
It seems to be stable, at least I have not encountered a crash yet.  :)
However, it is a local build, not a RPM, therefore the execution path is different, /usr/local/bin v.s. /usr/bin.
Is there somewhere I can get an installable dev build RPM for CentOS 7?
It will be even better if you can release an official RPM from current code base.  Cord dump is difficult for end users unless them have the time and energy to trace down the issue and build from source.
 
Thanks for the help.

BTW, it would be nice to update the BUILD file to include the dependency of wxGTK-devel and gamin-devel in build steps.
It would not build without these two packages.

Alex

« Last Edit: January 30, 2019, 03:19:34 am by alexchen »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::Blocks crashes during project reload
« Reply #10 on: January 30, 2019, 08:42:44 am »
Is there somewhere I can get an installable dev build RPM for CentOS 7?
Yes, you can build yourself a package by first doing make dist and then rpmbuild -ta codeblocks*.tar.bz2. You have to setup rpmbuild first. Also you have to do make uninstall to make sure your /usr/local is cleaned before it isn't too late.

It rpmbuild fails. You can edit the .spec file and comment the ./bootstrap line and then do the rpmbuild -ba codeblocks.spec.
(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 alexchen

  • Multiple posting newcomer
  • *
  • Posts: 84
Re: Code::Blocks crashes during project reload
« Reply #11 on: February 03, 2019, 03:37:23 am »
I have built the RPM successfully. Thanks for the information.  I suggest we add the package dependency and the RPM build steps in the BUILD document for people who wants to build the RPM to be installed on multiple machines.