crash when changing reference .sch in eeschema

Bug #1835841 reported by Frank Severinsen on 2019-07-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Critical
Wayne Stambaugh

Bug Description

Please see attached video

It's a pretty rare case, but should probably still be fixed.

Application: Eeschema
Version: 5.1.2-br-unknown-01a343f~84~ubuntu19.04.1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.64.0 OpenSSL/1.1.1b zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh/0.8.6/openssl/zlib nghttp2/1.36.0 librtmp/2.3
Platform: Linux 5.0.0-20-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
    Boost: 1.67.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.64.0
    Compiler: GCC 8.3.0 with C++ ABI 1013

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=ON
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Stacktrace:

Thread 1 "kicad" received signal SIGSEGV, Segmentation fault.
0x00007ffff7133de0 in __dynamic_cast () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) bt
#0 0x00007ffff7133de0 in __dynamic_cast () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x00007fffc78444d9 in () at /usr/bin/_eeschema.kiface
#2 0x00007fffc7834a7b in () at /usr/bin/_eeschema.kiface
#3 0x00007fffc7870136 in () at /usr/bin/_eeschema.kiface
#4 0x00007fffc785be16 in () at /usr/bin/_eeschema.kiface
#5 0x00007ffff74e5a8e in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#6 0x00007ffff74e5b93 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#7 0x00007ffff74e5ecc in wxEvtHandler::TryHereOnly(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#8 0x00007fffc799d9fc in () at /usr/bin/_eeschema.kiface
#9 0x00007ffff74e5d53 in wxEvtHandler::DoTryChain(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#10 0x00007ffff74e5ff1 in wxEvtHandler::ProcessEvent(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#11 0x00007fffc77a0241 in () at /usr/bin/_eeschema.kiface
#12 0x00007fffc7765877 in () at /usr/bin/_eeschema.kiface
#13 0x00007fffc77e5c6d in () at /usr/bin/_eeschema.kiface
#14 0x00007ffff74e5a8e in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#15 0x00007ffff74e5e0a in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#16 0x00007ffff74e5ea0 in wxEvtHandler::TryHereOnly(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#17 0x00007ffff74e5f53 in wxEvtHandler::ProcessEventLocally(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#18 0x00007ffff74e5ff1 in wxEvtHandler::ProcessEvent(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#19 0x00007ffff7a83f6d in wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#20 0x00007ffff74e5d97 in wxEvtHandler::SafelyProcessEvent(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#21 0x00007ffff788f386 in wxWindow::GTKDoInsertTextFromIM(char const*) () at /usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#22 0x00007ffff64e5b97 in g_cclosure_marshal_VOID__STRINGv () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007ffff64e30c6 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007ffff64ff57d in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#25 0x00007ffff6500046 in g_signal_emit_by_name () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#26 0x00007ffff64e5b97 in g_cclosure_marshal_VOID__STRINGv () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#27 0x00007ffff64e30c6 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#28 0x00007ffff64ff57d in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#29 0x00007ffff64ffb6f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#30 0x00007ffff04fdb33 in () at /usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-ibus.so
#31 0x00007ffff6843833 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#32 0x00007ffff7892aac in () at /usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#33 0x00007ffff69f344b in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#34 0x00007ffff64e2e8d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#35 0x00007ffff64f6555 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#36 0x00007ffff64feb9b in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#37 0x00007ffff64ffb6f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#38 0x00007ffff69a01f4 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#39 0x00007ffff69c149b in gtk_window_propagate_key_event () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#40 0x00007ffff787fc18 in () at /usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#41 0x00007ffff69f344b in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#42 0x00007ffff64e2e8d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#43 0x00007ffff64f6555 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#44 0x00007ffff64feb9b in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#45 0x00007ffff64ffb6f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#46 0x00007ffff69a01f4 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#47 0x00007ffff6860d9f in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#48 0x00007ffff6862dfb in gtk_main_do_event () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#49 0x00007ffff65645e5 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#50 0x00007ffff6595292 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#51 0x00007ffff62699ee in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#52 0x00007ffff6269c88 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#53 0x00007ffff6269f82 in g_main_loop_run () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#54 0x00007ffff6861e75 in gtk_main () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#55 0x00007ffff786dc95 in wxGUIEventLoop::DoRun() () at /usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#56 0x00007ffff73bb76d in wxEventLoopBase::Run() () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#57 0x00007ffff73848f6 in wxAppConsoleBase::MainLoop() () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#58 0x00005555555f09d9 in ()
#59 0x00007ffff7405fd9 in wxEntry(int&, wchar_t**) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#60 0x00005555555d6788 in ()
#61 0x00007ffff6d42b6b in __libc_start_main (main=0x5555555d6760, argc=1, argv=0x7fffffffdf08, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffdef8)
    at ../csu/libc-start.c:308
#62 0x00005555555daeda in _start ()

Frank Severinsen (shack) wrote :
summary: - crash when changing refernce .sch in eeschema
+ crash when changing reference .sch in eeschema
Ian McInerney (imcinerney) wrote :

Frank,

Thanks for the backtrace, but it appears to be missing the symbol information from KiCad (so while it appears to be because of a type casting, it doesn't say where it was casting it). Are you running an Ubuntu mightly build? If so, I believe you can install the package kicad-dbg to get the debug symbols, which should make the backtrace better?

I am also trying to deduce the steps you used to create this, are these correct?

1) Append schematic from another project to the current project
2) Change the subsheet to be a new sheet (not in the original project)

Frank Severinsen (shack) wrote :
Download full text (7.2 KiB)

steps seems right, but in step 1 I believe the appended root must contain subsheets.
I found the crash when playing around with this: https://bugs.launchpad.net/kicad/+bug/1834317

new backtrace after installing kicad-dbg:
#0 0x00007ffff7133de0 in __dynamic_cast ()
    at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x00007fffc78444d9 in SCH_SHEET::GetRootSheet()
    (this=this@entry=0x555558895630) at ./kicad/eeschema/sch_sheet.cpp:137
#2 0x00007fffc7834a7b in SCH_LEGACY_PLUGIN::Load(wxString const&, KIWAY*, SCH_SHEET*, PROPERTIES const*) (this=
    0x555555a54cc0, aFileName=..., aKiway=0x555555735340 <Kiway>, aAppendToMe=0x555558895630, aProperties=0x0) at ./kicad/eeschema/sch_legacy_plugin.cpp:638
#3 0x00007fffc7870136 in SCH_EDIT_FRAME::EditSheet(SCH_SHEET*, SCH_SHEET_PATH*, bool*) (this=this@entry=
    0x555556e9afb0, aSheet=aSheet@entry=0x555558895630, aHierarchy=0x5555581d45a0, aClearAnnotationNewItems=aClearAnnotationNewItems@entry=0x7fffffffbc0f)
    at ./kicad/include/kiway_player.h:64
#4 0x00007fffc785be16 in SCH_EDIT_FRAME::OnEditItem(wxCommandEvent&)
    (this=0x555556e9afb0, aEvent=...) at ./kicad/eeschema/schedit.cpp:1062
#5 0x00007ffff74e5a8e in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
    at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#6 0x00007ffff74e5b93 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#7 0x00007ffff74e5ecc in wxEvtHandler::TryHereOnly(wxEvent&) ()
    at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#8 0x00007fffc799d9fc in EDA_BASE_FRAME::ProcessEvent(wxEvent&)
--Type <RET> for more, q to quit, c to continue without paging--
    (this=0x555556e9afb0, aEvent=...) at ./kicad/common/eda_base_frame.cpp:173
#9 0x00007ffff74e5d53 in wxEvtHandler::DoTryChain(wxEvent&) ()
    at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#10 0x00007ffff74e5ff1 in wxEvtHandler::ProcessEvent(wxEvent&) ()
    at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#11 0x00007fffc77a0241 in SCH_EDIT_FRAME::OnHotKey(wxDC*, int, wxPoint const&, EDA_ITEM*)
    (this=0x555556e9afb0, aDC=0x0, aHotKey=<optimised out>, aPosition=..., aItem=0x0) at /usr/include/wx-3.0/wx/window.h:846
#12 0x00007fffc7765877 in SCH_EDIT_FRAME::GeneralControl(wxDC*, wxPoint const&, unsigned int) (this=0x555556e9afb0, aDC=0x0, aPosition=..., aHotKey=101)
    at ./kicad/include/base_screen.h:233
#13 0x00007fffc77e5c6d in SCH_DRAW_PANEL::OnKeyEvent(wxKeyEvent&)
    (this=0x555556eca670, event=...)
    at /usr/include/c++/8/ext/new_allocator.h:86
#14 0x00007ffff74e5a8e in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
    at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#15 0x00007ffff74e5e0a in wxEvtHandler::SearchDynamicEventTable(wxEvent&) ()
    at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#16 0x00007ffff74e5ea0 in wxEvtHandler::TryHereOnly(wxEvent&) ()
    at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#17 0x00007ffff74e5f53 in wxEvtHandler::ProcessEventLocally(wxEvent&) ()
--Type <RET> for more, q to quit, c to continue without paging--
    at /usr/lib/x86_64-linux-gnu/libwx_b...

Read more...

Ian McInerney (imcinerney) wrote :

Ok, thanks. I can recreate this crash with the added fact that the sheet you are changing to is not in the same directory as the sheet that was appended (e.g. the appended sheet is outside the project but the sheet being changed to is in the project directory).

Changed in kicad:
status: New → Triaged
importance: Undecided → Critical
assignee: nobody → Wayne Stambaugh (stambaughw)
Changed in kicad:
milestone: none → 5.1.3
tags: added: eeschema
Wayne Stambaugh (stambaughw) wrote :

@Frank, your timing is impeccable ;) I hate to do this but I'm going to defer this to 5.1.4 even though it is a critical bug. There are multiple issues at work here not just changing the name of the sheet. The amount of work to fix all of the issues will be substantial and will require numerous complex warning strings and we are currently in string freeze for 5.1.3. This bug also exists in master so I will start fixing it there and cherry-pick the changes for 5.1.4.

Frank Severinsen (shack) wrote :

@Wayne you know I only finds the good bugs when you annonce an upcoming release :p

Personally I don't mind waiting for V5.1.4, I couldn't reproduce this in a "natural" way. I only found it due to the investigation of the other bug/opinion.

Wayne Stambaugh (stambaughw) wrote :

@Frank, it took me quite a few tries to find the right project to append that would trigger the bug so it's going to be fairly rare. The problem is the fix is going to be complex so I want to push it to the dev branch for testing before I merge it into the 5.1 branch.

Changed in kicad:
milestone: 5.1.3 → 5.1.4
Changed in kicad:
status: Triaged → In Progress
Wayne Stambaugh (stambaughw) wrote :

@Frank, I just pushed the fix for this into the master branch. Please test it when you get a chance to see if it resolves the issue. I want to get some testing before I cherry-pick it into the 5.1 branch.

KiCad Janitor (kicad-janitor) wrote :

Fixed in revision b595dc0d3b131ba70f9a5327f6b2e1892e4dc7f8
https://git.launchpad.net/kicad/patch/?id=b595dc0d3b131ba70f9a5327f6b2e1892e4dc7f8

Changed in kicad:
status: In Progress → Fix Committed
Changed in kicad:
milestone: 5.1.4 → 5.1.5
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers