Author Topic: Crash with batch build on linux  (Read 2548 times)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2455
Crash with batch build on linux
« on: June 15, 2019, 11:45:05 am »
Hi, i use the command line on my headless server to build codeblocks projects...
I can not reproduce this 100% but it occurs 1 in 6 times: I get a crash "call of pure virtual function" on the finish of a compilation.
This is the backtrace:
Code: [Select]
#0  0x00007ffff41dee97 in raise () at /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff41e0801 in abort () at /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff4bd3957 in  () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff4bd9ab6 in  () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff4bd9af1 in  () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff4bda8bf in  () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff5bf2e29 in wxTextEntryBase::DoSetValue(wxString const&, int) () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#7  0x00007ffff5acd507 in  () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#8  0x00007ffff76b2a2b in TextCtrlLogger::Clear() (this=0x555556356c40) at loggers.cpp:165
#9  0x00007fffe91d91f1 in CompilerGCC::ClearLog(bool) (this=0x555555fcc0f0, switchToLog=false) at compilergcc.cpp:1079
#10 0x00007fffe91e840b in CompilerGCC::OnWorkspaceClosed(CodeBlocksEvent&) (this=0x555555fcc0f0, event=...) at compilergcc.cpp:3437
#11 0x00007fffe91f9411 in cbEventFunctor<CompilerGCC, CodeBlocksEvent>::Call(CodeBlocksEvent&) (this=0x555556533590, event=...) at ../../../src/include/cbfunctor.h:49
#12 0x00007ffff76c3e9a in Manager::ProcessEvent(CodeBlocksEvent&) (this=0x555555b26ba0, event=...) at manager.cpp:263
#13 0x00007ffff76e262b in PluginManager::NotifyPlugins(CodeBlocksEvent&) (this=0x555555f17700, event=...) at pluginmanager.cpp:1522
#14 0x00007ffff770e88f in ProjectManager::CloseWorkspace() (this=0x555555d8f900) at projectmanager.cpp:620
#15 0x00005555556807a7 in MainFrame::DoCloseCurrentWorkspace() (this=0x555555bdb710) at main.cpp:2049
#16 0x0000555555687529 in MainFrame::OnApplicationClose(wxCloseEvent&) (this=0x555555bdb710, event=...) at main.cpp:2929
#17 0x00007ffff52d24be in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#18 0x00007ffff52d25c3 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#19 0x00007ffff52d298b in wxEvtHandler::TryHereOnly(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#20 0x00007ffff52d2783 in wxEvtHandler::DoTryChain(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#21 0x00007ffff52d2a75 in wxEvtHandler::ProcessEvent(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#22 0x00007ffff52d27d7 in wxEvtHandler::SafelyProcessEvent(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#23 0x00007ffff5c039d7 in wxWindowBase::Close(bool) () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#24 0x0000555555605c25 in CodeBlocksApp::OnInit() (this=0x555555a675c0) at app.cpp:759
#25 0x000055555560d5d9 in wxAppConsoleBase::CallOnInit() (this=0x555555a675c0) at /usr/include/wx-3.0/wx/app.h:93
#26 0x00007ffff51e0b3a in wxEntry(int&, wchar_t**) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#27 0x0000555555603bcb in main(int, char**) (argc=5, argv=0x7fffffffe428) at app.cpp:338
Any ideas how to debug this?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Crash with batch build on linux
« Reply #1 on: June 15, 2019, 02:20:39 pm »
Run cb from cb and debug it with gdb. Just edit the program arguments and/or work folder.

Most probably the text logger is already deleted when clear is called.
(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 BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2455
Re: Crash with batch build on linux
« Reply #2 on: June 16, 2019, 07:03:45 pm »
Wasn't there a ticket or a forum post about the log panel with a fix lately?
I can not find it anymore...

Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 333
Re: Crash with batch build on linux
« Reply #3 on: June 16, 2019, 07:32:31 pm »
Ticket 738:

https://sourceforge.net/p/codeblocks/tickets/738/

I added a check about batch building before clearing the log, but it wasn't accepted.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Crash with batch build on linux
« Reply #4 on: June 16, 2019, 10:21:19 pm »
@Miguel: If you look at the backtrace you'll see that this for the clear call is not nullptr, so your fix would probably be unhelpful in this case.
(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 Miguel Gimenez

  • Regular
  • ***
  • Posts: 333
Re: Crash with batch build on linux
« Reply #5 on: June 17, 2019, 11:30:53 am »
While investigating the crash I found this code snippet (not related directly to the crash) in compilergcc.cpp:

Code: [Select]
        if (!Manager::IsBatchBuild())
        {
            CodeBlocksLogEvent evt(cbEVT_REMOVE_LOG_WINDOW, m_pLog);
            Manager::Get()->ProcessEvent(evt);
        }

        {
            // TODO: This is wrong. We need some automatic way for this to happen!!!
            LogSlot &listSlot = logManager->Slot(m_ListPageIndex);
            delete listSlot.icon;
            listSlot.icon = nullptr;

            LogSlot &slot = logManager->Slot(m_PageIndex);
            delete slot.icon;
            slot.icon = nullptr;
        }

        m_pLog = 0;

The log window removal is made conditionally, but the nullifying of m_pLog always happens. Is this correct?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2455
Re: Crash with batch build on linux
« Reply #6 on: July 23, 2019, 12:10:36 am »
Quote
While investigating the crash I found this code snippet (not related directly to the crash) in compilergcc.cpp:
So you can reproduce the crash?

Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 333
Re: Crash with batch build on linux
« Reply #7 on: July 23, 2019, 11:58:21 am »
Didn't try. I haven't used batch building since ticket 738, and the crash I got is fixed in my local copy.

Post the full command you use, if I get time I'll check.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2455
Re: Crash with batch build on linux
« Reply #8 on: July 25, 2019, 11:35:48 pm »
Code: [Select]
==26161==ERROR: AddressSanitizer: heap-use-after-free on address 0x61a000090bc0 at pc 0x7fd9158e6a41 bp 0x7fffba69c060 sp 0x7fffba69c050
READ of size 8 at 0x61a000090bc0 thread T0
    #0 0x7fd9158e6a40 in TextCtrlLogger::Clear() (/home/codeblocks/codeblocks/src/output30/libcodeblocks.so+0x8a8a40)
    #1 0x7fd90153e22e in CompilerGCC::ClearLog(bool) (/home/codeblocks/codeblocks/src/output30/share/codeblocks/plugins/libcompiler.so+0x10422e)
    #2 0x7fd9015649b6 in CompilerGCC::OnWorkspaceClosed(CodeBlocksEvent&) (/home/codeblocks/codeblocks/src/output30/share/codeblocks/plugins/libcompiler.so+0x12a9b6)
    #3 0x7fd901588eb3 in cbEventFunctor<CompilerGCC, CodeBlocksEvent>::Call(CodeBlocksEvent&) (/home/codeblocks/codeblocks/src/output30/share/codeblocks/plugins/libcompiler.so+0x14eeb3)
    #4 0x7fd9159107f0 in Manager::ProcessEvent(CodeBlocksEvent&) (/home/codeblocks/codeblocks/src/output30/libcodeblocks.so+0x8d27f0)
    #5 0x7fd91596ee68 in PluginManager::NotifyPlugins(CodeBlocksEvent&) (/home/codeblocks/codeblocks/src/output30/libcodeblocks.so+0x930e68)
    #6 0x7fd9159da356 in ProjectManager::CloseWorkspace() (/home/codeblocks/codeblocks/src/output30/libcodeblocks.so+0x99c356)
    #7 0x55778b662f64  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x290f64)
    #8 0x55778b67490b  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x2a290b)
    #9 0x7fd9168674bd in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0+0x1e34bd)
    #10 0x7fd9168675c2 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0+0x1e35c2)
    #11 0x7fd91686798a in wxEvtHandler::TryHereOnly(wxEvent&) (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0+0x1e398a)
    #12 0x7fd916867782 in wxEvtHandler::DoTryChain(wxEvent&) (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0+0x1e3782)
    #13 0x7fd916867a74 in wxEvtHandler::ProcessEvent(wxEvent&) (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0+0x1e3a74)
    #14 0x7fd9168677d6 in wxEvtHandler::SafelyProcessEvent(wxEvent&) (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0+0x1e37d6)
    #15 0x7fd9171989d6 in wxWindowBase::Close(bool) (/usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0+0x4419d6)
    #16 0x55778b52e391  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x15c391)
    #17 0x55778b54085b  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x16e85b)
    #18 0x7fd916775b39 in wxEntry(int&, wchar_t**) (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0+0xf1b39)
    #19 0x55778b528e66  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x156e66)
    #20 0x7fd914110b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #21 0x55778b526dd9  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x154dd9)

0x61a000090bc0 is located 1344 bytes inside of 1408-byte region [0x61a000090680,0x61a000090c00)
freed by thread T0 here:
    #0 0x7fd9187b22d0 in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe12d0)
    #1 0x7fd917197316 in wxWindowBase::Destroy() (/usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0+0x440316)

previously allocated by thread T0 here:
    #0 0x7fd9187b1458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
    #1 0x7fd9158e6be1 in TextCtrlLogger::CreateControl(wxWindow*) (/home/codeblocks/codeblocks/src/output30/libcodeblocks.so+0x8a8be1)
    #2 0x7fd90157e7e9 in BuildLogger::CreateControl(wxWindow*) (/home/codeblocks/codeblocks/src/output30/share/codeblocks/plugins/libcompiler.so+0x1447e9)
    #3 0x55778b68c058  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x2ba058)
    #4 0x55778b6beea3  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x2ecea3)
    #5 0x7fd915911534 in Manager::ProcessEvent(CodeBlocksLogEvent&) (/home/codeblocks/codeblocks/src/output30/libcodeblocks.so+0x8d3534)
    #6 0x7fd901530e5c in CompilerGCC::OnAttach() (/home/codeblocks/codeblocks/src/output30/share/codeblocks/plugins/libcompiler.so+0xf6e5c)
    #7 0x7fd9156bf8ab in cbPlugin::Attach() (/home/codeblocks/codeblocks/src/output30/libcodeblocks.so+0x6818ab)
    #8 0x7fd915958536 in PluginManager::AttachPlugin(cbPlugin*, bool) (/home/codeblocks/codeblocks/src/output30/libcodeblocks.so+0x91a536)
    #9 0x7fd91596a2db in PluginManager::LoadAllPlugins() (/home/codeblocks/codeblocks/src/output30/libcodeblocks.so+0x92c2db)
    #10 0x55778b652241  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x280241)
    #11 0x55778b6417bb  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x26f7bb)
    #12 0x55778b529d6c  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x157d6c)
    #13 0x55778b52dcc1  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x15bcc1)
    #14 0x55778b54085b  (/home/codeblocks/codeblocks/src/output30/codeblocks+0x16e85b)
    #15 0x7fd916775b39 in wxEntry(int&, wchar_t**) (/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0+0xf1b39)

SUMMARY: AddressSanitizer: heap-use-after-free (/home/codeblocks/codeblocks/src/output30/libcodeblocks.so+0x8a8a40) in TextCtrlLogger::Clear()
Shadow bytes around the buggy address:
  0x0c348000a120: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c348000a130: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c348000a140: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c348000a150: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c348000a160: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c348000a170: fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd fd fd
  0x0c348000a180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c348000a190: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c348000a1a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c348000a1b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c348000a1c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==26161==ABORTING

sadly the backtrace of the free is not really helpful :(

{edit] the command line:
Code: [Select]
output30/run.sh --target=All --no-splash-screen --build CodeBlocks_wx30-unix.workspace you probably have to run it a view times until you trigger it...
« Last Edit: July 25, 2019, 11:40:09 pm by BlueHazzard »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Crash with batch build on linux
« Reply #9 on: July 26, 2019, 12:50:05 am »
Rebuild everything with -fno-omit-frame-pointer.
(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 BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2455
Re: Crash with batch build on linux
« Reply #10 on: July 26, 2019, 08:22:56 am »
By everything you mean also wxWidgets? Because codeblocks is build with -fno-omit-frame-pointer

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Crash with batch build on linux
« Reply #11 on: July 26, 2019, 08:40:13 am »
The whole system would be best, but yes building wx with -fno-omit-frame-pointer improves backtraces produced by asan.
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Crash with batch build on linux
« Reply #12 on: July 26, 2019, 08:45:52 am »
But you don't need asan for tracking this problem just place a breakpoint on ~TextCtrlLogger and you'll find who is deleting it.
(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 BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2455
Re: Crash with batch build on linux
« Reply #13 on: July 26, 2019, 10:04:48 am »
Code: [Select]
[debug]=================================================================
[debug]==16639==ERROR: AddressSanitizer: heap-use-after-free on address 0x61a0000809c0 at pc 0x7ffff4c90861 bp 0x7fffffffba00 sp 0x7fffffffb9f0
[debug]READ of size 8 at 0x61a0000809c0 thread T0
[debug]    #0 0x7ffff4c90860 in TextCtrlLogger::Clear() /home/codeblocks/codeblocks/src/sdk/loggers.cpp:165
[debug]    #1 0x7fffe217813e in CompilerGCC::ClearLog(bool) /home/codeblocks/codeblocks/src/plugins/compilergcc/compilergcc.cpp:1108
[debug]    #2 0x7fffe219e8c6 in CompilerGCC::OnWorkspaceClosed(CodeBlocksEvent&) /home/codeblocks/codeblocks/src/plugins/compilergcc/compilergcc.cpp:3466
[debug]    #3 0x7fffe21c2dc3 in cbEventFunctor<CompilerGCC, CodeBlocksEvent>::Call(CodeBlocksEvent&) /home/codeblocks/codeblocks/src/include/cbfunctor.h:49
[debug]    #4 0x7ffff4cba610 in Manager::ProcessEvent(CodeBlocksEvent&) /home/codeblocks/codeblocks/src/sdk/manager.cpp:269
[debug]    #5 0x7ffff4d18c88 in PluginManager::NotifyPlugins(CodeBlocksEvent&) /home/codeblocks/codeblocks/src/sdk/pluginmanager.cpp:1522
[debug]    #6 0x7ffff4d84176 in ProjectManager::CloseWorkspace() /home/codeblocks/codeblocks/src/sdk/projectmanager.cpp:620
[debug]    #7 0x5555557e4d94 in MainFrame::DoCloseCurrentWorkspace() /home/codeblocks/codeblocks/src/src/main.cpp:2136
[debug]    #8 0x5555557f673b in MainFrame::OnApplicationClose(wxCloseEvent&) /home/codeblocks/codeblocks/src/src/main.cpp:3015
[debug]    #9 0x7ffff602e4e1 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x5fb4e1)
[debug]    #10 0x7ffff602e5ea in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x5fb5ea)
[debug]    #11 0x7ffff602e9f6 in wxEvtHandler::TryHereOnly(wxEvent&) (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x5fb9f6)
[debug]    #12 0x7ffff602e7e5 in wxEvtHandler::DoTryChain(wxEvent&) (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x5fb7e5)
[debug]    #13 0x7ffff602ead5 in wxEvtHandler::ProcessEvent(wxEvent&) (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x5fbad5)
[debug]    #14 0x7ffff602e83e in wxEvtHandler::SafelyProcessEvent(wxEvent&) (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x5fb83e)
[debug]    #15 0x7ffff6275777 in wxWindowBase::Close(bool) (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x842777)
[debug]    #16 0x5555556b01c1 in CodeBlocksApp::OnInit() /home/codeblocks/codeblocks/src/src/app.cpp:753
[debug]    #17 0x5555556c268b in wxAppConsoleBase::CallOnInit() (/home/codeblocks/codeblocks/src/devel30/codeblocks+0x16e68b)
[debug]    #18 0x7ffff5f3efa1 in wxEntry(int&, wchar_t**) (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x50bfa1)
[debug]    #19 0x5555556aac96 in main /home/codeblocks/codeblocks/src/src/app.cpp:338
[debug]    #20 0x7ffff34bab96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
[debug]    #21 0x5555556a8c09 in _start (/home/codeblocks/codeblocks/src/devel30/codeblocks+0x154c09)
[debug]0x61a0000809c0 is located 1344 bytes inside of 1408-byte region [0x61a000080480,0x61a000080a00)
[debug]freed by thread T0 here:
[debug]    #0 0x7ffff6efb9d8 in operator delete(void*, unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe19d8)
[debug]    #1 0x7ffff6273fbe in wxWindowBase::Destroy() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x840fbe)
[debug]    #2 0x7ffff627400b in wxWindowBase::DestroyChildren() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x84100b)
[debug]    #3 0x7ffff60afbab in wxWindow::~wxWindow() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x67cbab)
[debug]    #4 0x7ffff622e3ca in wxPanel::~wxPanel() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x7fb3ca)
[debug]    #5 0x7ffff6273fbe in wxWindowBase::Destroy() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x840fbe)
[debug]    #6 0x7ffff64ac83c in wxAuiNotebook::DeletePage(unsigned long) (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0xa7983c)
[debug]    #7 0x7ffff64b3739 in wxAuiNotebook::~wxAuiNotebook() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0xa80739)
[debug]    #8 0x7ffff4a0956e in cbAuiNotebook::~cbAuiNotebook() /home/codeblocks/codeblocks/src/sdk/cbauibook.cpp:80
[debug]    #9 0x5555557b8993 in InfoPane::~InfoPane() /home/codeblocks/codeblocks/src/src/infopane.cpp:65
[debug]    #10 0x5555557b89bf in InfoPane::~InfoPane() /home/codeblocks/codeblocks/src/src/infopane.cpp:72
[debug]    #11 0x7ffff6273fbe in wxWindowBase::Destroy() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x840fbe)
[debug]    #12 0x7ffff627400b in wxWindowBase::DestroyChildren() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x84100b)
[debug]    #13 0x7ffff60afbab in wxWindow::~wxWindow() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x67cbab)
[debug]    #14 0x5555556f986e in wxScrollingDialog::~wxScrollingDialog() /home/codeblocks/codeblocks/src/include/scrollingdialog.h:163
[debug]    #15 0x555555840724 in BatchLogWindow::~BatchLogWindow() /home/codeblocks/codeblocks/src/src/batchbuild.h:15
[debug]    #16 0x55555584073f in BatchLogWindow::~BatchLogWindow() /home/codeblocks/codeblocks/src/src/batchbuild.h:15
[debug]    #17 0x7ffff5eb01fa in wxAppConsoleBase::DeletePendingObjects() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x47d1fa)
[debug]    #18 0x7ffff5eb0273 in wxAppConsoleBase::ProcessIdle() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x47d273)
[debug]    #19 0x7ffff614ccdb in wxAppBase::ProcessIdle() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x719cdb)
[debug]    #20 0x7ffff6072a98 in wxApp::DoIdle() (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x63fa98)
[debug]    #21 0x7ffff6072ba2 in wxapp_idle_callback (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x63fba2)
[debug]    #22 0x7ffff148d284 in g_main_context_dispatch (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4c284)
[debug]previously allocated by thread T0 here:
[debug]    #0 0x7ffff6efa458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
[debug]    #1 0x7ffff4c90a01 in TextCtrlLogger::CreateControl(wxWindow*) /home/codeblocks/codeblocks/src/sdk/loggers.cpp:171
[debug]    #2 0x7fffe21b86f9 in BuildLogger::CreateControl(wxWindow*) (/home/codeblocks/codeblocks/src/devel30/share/codeblocks/plugins/libcompiler.so+0x1446f9)
[debug]    #3 0x55555580de88 in MainFrame::OnAddLogWindow(CodeBlocksLogEvent&) /home/codeblocks/codeblocks/src/src/main.cpp:5146
[debug]    #4 0x555555840cd3 in cbEventFunctor<MainFrame, CodeBlocksLogEvent>::Call(CodeBlocksLogEvent&) /home/codeblocks/codeblocks/src/include/cbfunctor.h:49
[debug]    #5 0x7ffff4cbb354 in Manager::ProcessEvent(CodeBlocksLogEvent&) /home/codeblocks/codeblocks/src/sdk/manager.cpp:337
[debug]    #6 0x7fffe216ad6c in CompilerGCC::OnAttach() /home/codeblocks/codeblocks/src/plugins/compilergcc/compilergcc.cpp:414
[debug]    #7 0x7ffff4a696cb in cbPlugin::Attach() /home/codeblocks/codeblocks/src/sdk/cbplugin.cpp:73
[debug]    #8 0x7ffff4d02356 in PluginManager::AttachPlugin(cbPlugin*, bool) /home/codeblocks/codeblocks/src/sdk/pluginmanager.cpp:197
[debug]    #9 0x7ffff4d140fb in PluginManager::LoadAllPlugins() /home/codeblocks/codeblocks/src/sdk/pluginmanager.cpp:1108
[debug]    #10 0x5555557d4071 in MainFrame::ScanForPlugins() /home/codeblocks/codeblocks/src/src/main.cpp:1299
[debug]    #11 0x5555557c35eb in MainFrame::MainFrame(wxWindow*) /home/codeblocks/codeblocks/src/src/main.cpp:633
[debug]    #12 0x5555556abb9c in CodeBlocksApp::InitFrame() /home/codeblocks/codeblocks/src/src/app.cpp:505
[debug]    #13 0x5555556afaf1 in CodeBlocksApp::OnInit() /home/codeblocks/codeblocks/src/src/app.cpp:720
[debug]    #14 0x5555556c268b in wxAppConsoleBase::CallOnInit() (/home/codeblocks/codeblocks/src/devel30/codeblocks+0x16e68b)
[debug]    #15 0x7ffff5f3efa1 in wxEntry(int&, wchar_t**) (/home/codeblocks/wxInstall30/lib/libwx_gtk2u-3.0.so.0+0x50bfa1)
[debug]    #16 0x5555556aac96 in main /home/codeblocks/codeblocks/src/src/app.cpp:338
[debug]    #17 0x7ffff34bab96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
[debug]SUMMARY: AddressSanitizer: heap-use-after-free /home/codeblocks/codeblocks/src/sdk/loggers.cpp:165 in TextCtrlLogger::Clear()

This output is somehow more useful then the debugger or not? Anyway, i wanted to learn how to use the address sanitizer and now i have a chance to use it :)

The question now is, why is the window destroyed before the application exits?
« Last Edit: July 26, 2019, 10:08:58 am by BlueHazzard »

Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 333
Re: Crash with batch build on linux
« Reply #14 on: July 26, 2019, 01:54:49 pm »
The question now is, why is the window destroyed before the application exits?

Because in batch mode it is not needed anymore. The crash is due to the destruction of the log window before closing the workspace, as there is a call to ClearLog() in the workspace closing event.

Solutions:
  - Use --no-batch-window-close in the command line call
  - Destroy the window after closing the workspace, not before
  - Use my patch in ticket 738
  - Mark the window as destroyed and don't call ClearLog() if it is marked
  - Remove the call to ClearLog() from the workspace closing event