eeschema: Crash on opening schematic

Bug #1822678 reported by Michael Geselbracht
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
Critical
Jeff Young

Bug Description

As of commit 2466b4363 (bisected) eeschema crashes while opening a "more complex" schematic.
The pic_programmer demo can be opened without any issues. But "bigger" projects lead to an immediate crash. Reverting the commit resolves this issue.

With one project there is a "kicad Error" dialog with the message "Unhandled exception class: St9bad_alloc what: std::bad_alloc"

Steps to reproduce:
1. Open demo project "complex_hierarchy" with kicad launcher.
2. Click on "Schematic Layout Editor" tool button -> crash

Backtrace:
#0 0x00007fffd5861eae in SCH_CONNECTION::Type() const (this=0x0) at /data/src/kicad-source-mirror/eeschema/./sch_connection.h:172
#1 0x00007fffd59230e0 in SCH_CONNECTION::Clone(SCH_CONNECTION&) (this=0x555558104270, aOther=...) at /data/src/kicad-source-mirror/eeschema/sch_connection.cpp:207
#2 0x00007fffd585b8d0 in CONNECTION_GRAPH::buildConnectionGraph() (this=0x555556d5c740) at /data/src/kicad-source-mirror/eeschema/connection_graph.cpp:1008
#3 0x00007fffd5858950 in CONNECTION_GRAPH::Recalculate(SCH_SHEET_LIST, bool) (this=0x555556d5c740, aSheetList=..., aUnconditional=true)
    at /data/src/kicad-source-mirror/eeschema/connection_graph.cpp:305
#4 0x00007fffd59b9b5d in SCH_EDIT_FRAME::RecalculateConnections() (this=0x555556d1ab10) at /data/src/kicad-source-mirror/eeschema/sch_edit_frame.cpp:1530
#5 0x00007fffd5896381 in SCH_EDIT_FRAME::OpenProjectFiles(std::vector<wxString, std::allocator<wxString> > const&, int) (this=0x555556d1ab10, aFileSet=std::vector of length 1, capacity 1 = {...}, aCtl=0) at /data/src/kicad-source-mirror/eeschema/files-io.cpp:378
#6 0x00005555556082cc in KICAD_MANAGER_FRAME::RunEeschema(wxString const&) (this=0x555555a6d130, aProjectSchematicFileName=...) at /data/src/kicad-source-mirror/kicad/mainframe.cpp:311
#7 0x00005555556086ba in KICAD_MANAGER_FRAME::OnRunEeschema(wxCommandEvent&) (this=0x555555a6d130, event=...) at /data/src/kicad-source-mirror/kicad/mainframe.cpp:335
#8 0x00007ffff67754be in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#9 0x00007ffff67755c3 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#10 0x00007ffff677598b in wxEvtHandler::TryHereOnly(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#11 0x000055555564829e in EDA_BASE_FRAME::ProcessEvent(wxEvent&) (this=0x555555a6d130, aEvent=...) at /data/src/kicad-source-mirror/common/eda_base_frame.cpp:173
#12 0x00007ffff6775783 in wxEvtHandler::DoTryChain(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#13 0x00007ffff6775a75 in wxEvtHandler::ProcessEvent(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#14 0x00007ffff70a518b in wxWindowBase::TryAfter(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#15 0x00007ffff70a518b in wxWindowBase::TryAfter(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#16 0x00007ffff67757d7 in wxEvtHandler::SafelyProcessEvent(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#17 0x00007ffff6f234b7 in () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#18 0x00007ffff488910d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#19 0x00007ffff489bbf1 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007ffff48a4715 in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007ffff48a512f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007ffff4e0f6f5 in () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#23 0x00007ffff488910d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007ffff489c12e in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#25 0x00007ffff48a4715 in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#26 0x00007ffff48a512f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#27 0x00007ffff4e0e679 in () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#28 0x00007ffff4eb438b in () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#29 0x00007ffff488910d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#30 0x00007ffff489bde8 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#31 0x00007ffff48a40af in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#32 0x00007ffff48a512f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#33 0x00007ffff4fca2bc in () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#34 0x00007ffff4eb262c in gtk_propagate_event () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#35 0x00007ffff4eb2a2b in gtk_main_do_event () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#36 0x00007ffff4b2802c in () at /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#37 0x00007ffff413e387 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#38 0x00007ffff413e5c0 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#39 0x00007ffff413e8d2 in g_main_loop_run () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#40 0x00007ffff4eb1a37 in gtk_main () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#41 0x00007ffff6ec2b05 in wxGUIEventLoop::DoRun() () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#42 0x00007ffff6631a93 in wxEventLoopBase::Run() () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#43 0x00007ffff65f90a6 in wxAppConsoleBase::MainLoop() () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#44 0x0000555555605c51 in APP_KICAD::OnRun() (this=0x5555559efb50) at /data/src/kicad-source-mirror/kicad/kicad.cpp:267
#45 0x00007ffff6683ae9 in wxEntry(int&, wchar_t**) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#46 0x0000555555604597 in main(int, char**) (argc=1, argv=0x7fffffffdbd8) at /data/src/kicad-source-mirror/kicad/kicad.cpp:298

Version info:

Application: kicad
Version: (5.1.0-94-g2466b4363), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-46-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.65.1
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.58.0
    Compiler: GCC 7.3.0 with C++ ABI 1011

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

Tags: eeschema
Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

I'm seeing this as well, but I also can't open the pic_programmer.

Application: kicad
Version: (5.1.0-106-g5eb2a3349), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Platform: Mac OS X (Darwin 18.5.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (UTF-8,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 10.0.1 with C++ ABI 1002

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

Changed in kicad:
milestone: none → 6.0.0-rc1
status: New → Triaged
Changed in kicad:
importance: Undecided → High
Revision history for this message
Jeff Young (jeyjey) wrote :

I believe this is stack or heap corruption. I also get a crash opening schematics, but only sometimes, and with a different stacktrace.

Jeff Young (jeyjey)
Changed in kicad:
importance: High → Critical
Revision history for this message
Jon Evans (craftyjon) wrote :

Can you please check as of 8b30cd4389

Changed in kicad:
assignee: nobody → Jon Evans (craftyjon)
Revision history for this message
Michael Geselbracht (mgeselbracht) wrote :

Thanks, that commit seems to fix this issue.

Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

complex_heirarchy and pic_programmer now open fine but it crashes once you try and navigate into a hierarchal sheet

wxStringIteratorNode::DoSet(wxString const*, std::__1::__wrap_iter<char const*>*, std::__1::__wrap_iter<char*>*) string.h:4276
wxStringIteratorNode::wxStringIteratorNode(wxString const*, std::__1::__wrap_iter<char const*>*) string.h:365
wxStringIteratorNode::wxStringIteratorNode(wxString const*, std::__1::__wrap_iter<char const*>*) string.h:365
wxString::const_iterator::const_iterator(wxString const*, std::__1::__wrap_iter<char const*>) string.h:1010
wxString::const_iterator::const_iterator(wxString const*, std::__1::__wrap_iter<char const*>) string.h:1010
wxString::end() const string.h:1395
wxString::length() const string.h:1434
wxString::Len() const string.h:1491
SCH_FIELD::IsVoid() const sch_field.h:118
KIGFX::SCH_PAINTER::draw(SCH_FIELD*, int) sch_painter.cpp:1192
KIGFX::SCH_PAINTER::draw(SCH_COMPONENT*, int) sch_painter.cpp:1165
KIGFX::SCH_PAINTER::Draw(KIGFX::VIEW_ITEM const*, int) sch_painter.cpp:204
KIGFX::VIEW::updateItemGeometry(KIGFX::VIEW_ITEM*, int) view.cpp:1317
KIGFX::VIEW::invalidateItem(KIGFX::VIEW_ITEM*, int) view.cpp:1247
KIGFX::VIEW::UpdateItems() view.cpp:1435
EDA_DRAW_PANEL_GAL::onPaint(wxPaintEvent&) draw_panel_gal.cpp:182
SCH_DRAW_PANEL::onPaint(wxPaintEvent&) sch_draw_panel.cpp:704
wxEvtHandler::SearchDynamicEventTable(wxEvent&) 0x0000000105f3a9de
wxEvtHandler::ProcessEventLocally(wxEvent&) 0x0000000105f3a75b
wxEvtHandler::ProcessEvent(wxEvent&) 0x0000000105f3a604
wxEvtHandler::ProcessPendingEvents() 0x0000000105f3a1be
wxAppConsoleBase::ProcessPendingEvents() 0x0000000105de2e97
wxCFEventLoop::OSXCommonModeObserverCallBack(__CFRunLoopObserver*, int, void*) 0x0000000105f06372
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ 0x00007fff45b71e88
__CFRunLoopDoObservers 0x00007fff45b71dbd
__CFRunLoopRun 0x00007fff45b144d0
CFRunLoopRunSpecific 0x00007fff45b13e0e
RunCurrentEventLoopInMode 0x00007fff44e009db
ReceiveNextEventCommon 0x00007fff44e0061d
_BlockUntilNextEventMatchingListInModeWithFilter 0x00007fff44e004a6
_DPSNextEvent 0x00007fff4319affb
-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 0x00007fff43199d93
-[NSApplication run] 0x00007fff43193eb0
wxGUIEventLoop::OSXDoRun() 0x000000010586fedf
wxCFEventLoop::DoRun() 0x0000000105f06cd1
wxEventLoopBase::Run() 0x0000000105e28cc2
wxAppConsoleBase::MainLoop() 0x0000000105de2053
wxApp::OnRun() 0x0000000105802e1a
APP_KICAD::OnRun() kicad.cpp:267
wxEntry(int&, wchar_t**) 0x0000000105e6fe4a
main kicad.cpp:298
start 0x00007fff71f8c3d5
start 0x00007fff71f8c3d5

Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

Also trying to open kit-dev-coldfire-xilinx-5213 KiCad crashes immediately on open.

std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__is_long() const string:1406
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_pointer() const string:1500
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::begin() const string:906
bool boost::regex_match<std::__1::char_traits<char>, std::__1::allocator<char>, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags) regex_match.hpp:100
SCH_CONNECTION::IsBusGroupLabel(wxString const&) sch_connection.cpp:365
SCH_CONNECTION::ConfigureFromLabel(wxString) sch_connection.cpp:130
CONNECTION_GRAPH::buildConnectionGraph()::$_1::operator()() const connection_graph.cpp:665
decltype(std::__1::forward<CONNECTION_GRAPH::buildConnectionGraph()::$_1>(fp)(std::__1::forward<>(fp0))) std::__1::__invoke<CONNECTION_GRAPH::buildConnectionGraph()::$_1>(CONNECTION_GRAPH::buildConnectionGraph()::$_1&&) type_traits:4339
void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, CONNECTION_GRAPH::buildConnectionGraph()::$_1>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, CONNECTION_GRAPH::buildConnectionGraph()::$_1>&, std::__1::__tuple_indices<>) thread:342
void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, CONNECTION_GRAPH::buildConnectionGraph()::$_1> >(void*) thread:352
_pthread_body 0x00007fff7217a2eb
_pthread_start 0x00007fff7217d249
thread_start 0x00007fff7217940d

Revision history for this message
Michael Geselbracht (mgeselbracht) wrote :
Download full text (5.9 KiB)

I also see a crash with another schematics. Could be different issue though.

There is a dialog with backtrace:

ASSERT INFO:
/data/src/kicad-source-mirror/eeschema/connection_graph.cpp(1047): assert "power_object" failed in buildConnectionGraph().

BACKTRACE:
[1] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[2] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[3] wxEvtHandler::TryHereOnly(wxEvent&)
[4] wxEvtHandler::DoTryChain(wxEvent&)
[5] wxEvtHandler::ProcessEvent(wxEvent&)
[6] wxWindowBase::TryAfter(wxEvent&)
[7] wxWindowBase::TryAfter(wxEvent&)
[8] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[9] g_closure_invoke
[10] g_signal_emit_valist
[11] g_signal_emit
[12] g_closure_invoke
[13] g_signal_emit_valist
[14] g_signal_emit
[15] g_closure_invoke
[16] g_signal_emit_valist
[17] g_signal_emit
[18] gtk_propagate_event
[19] gtk_main_do_event
[20] g_main_context_dispatch
[21] g_main_loop_run
[22] gtk_main
[23] wxGUIEventLoop::DoRun()
[24] wxEventLoopBase::Run()
[25] wxAppConsoleBase::MainLoop()
[26] wxEntry(int&, wchar_t**)
[27] __libc_start_main
[28] _start

And GDB says:

#0 0x00007fffebe9042f in SCH_PIN_CONNECTION::GetDefaultNetName(SCH_SHEET_PATH) (this=0x0, aPath=...) at /data/src/kicad-source-mirror/eeschema/sch_pin_connection.cpp:53
#1 0x00007fffebd66e0b in CONNECTION_GRAPH::buildConnectionGraph() (this=0x55555691cf00) at /data/src/kicad-source-mirror/eeschema/connection_graph.cpp:1049
#2 0x00007fffebd63ab2 in CONNECTION_GRAPH::Recalculate(SCH_SHEET_LIST, bool) (this=0x55555691cf00, aSheetList=..., aUnconditional=true)
    at /data/src/kicad-source-mirror/eeschema/connection_graph.cpp:305
#3 0x00007fffebec4db3 in SCH_EDIT_FRAME::RecalculateConnections() (this=0x555556897210) at /data/src/kicad-source-mirror/eeschema/sch_edit_frame.cpp:1526
#4 0x00007fffebda14b9 in SCH_EDIT_FRAME::OpenProjectFiles(std::vector<wxString, std::allocator<wxString> > const&, int) (this=0x555556897210, aFileSet=std::vector of length 1, capacity 1 = {...}, aCtl=0) at /data/src/kicad-source-mirror/eeschema/files-io.cpp:378
#5 0x00007fffebec1f43 in SCH_EDIT_FRAME::OnLoadProject(wxCommandEvent&) (this=0x555556897210, event=...) at /data/src/kicad-source-mirror/eeschema/sch_edit_frame.cpp:1079
#6 0x00007ffff67754be in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#7 0x00007ffff67755c3 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#8 0x00007ffff677598b in wxEvtHandler::TryHereOnly(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#9 0x00007fffebffb054 in EDA_BASE_FRAME::ProcessEvent(wxEvent&) (this=0x555556897210, aEvent=...) at /data/src/kicad-source-mirror/common/eda_base_frame.cpp:173
#10 0x00007ffff6775783 in wxEvtHandler::DoTryChain(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#11 0x00007ffff6775a75 in wxEvtHandler::ProcessEvent(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#12 0x00007ffff70a518b in wxWindowBase::TryAfter(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#...

Read more...

Revision history for this message
Jon Evans (craftyjon) wrote :

I'm having trouble reproducing these crashes.
Michael K -- are you also on Linux?
Can either of you try rolling back to f1882f333e7e6a2e0a90272ab6a99bc975360d3a and seeing if that changes behavior?

Revision history for this message
Michael Geselbracht (mgeselbracht) wrote :

It looks like the "power_object" issue goes back to commit 83c7e7fc6. I have assembled a schematic with cache files.

'eeschema line-in.sch' crashes immediately on my machine.

Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :
Download full text (5.2 KiB)

@Jon, I'm on macOS, see my version info in comment #1. Rolling back to f1882f:

I can open and browse complex_heirarchy fine.

I can open pic_programmer but crash when trying to enter sheet:
wxStringIteratorNode::DoSet(wxString const*, std::__1::__wrap_iter<char const*>*, std::__1::__wrap_iter<char*>*) string.h:4276
wxStringIteratorNode::wxStringIteratorNode(wxString const*, std::__1::__wrap_iter<char const*>*) string.h:365
wxStringIteratorNode::wxStringIteratorNode(wxString const*, std::__1::__wrap_iter<char const*>*) string.h:365
wxString::const_iterator::const_iterator(wxString const*, std::__1::__wrap_iter<char const*>) string.h:1010
wxString::const_iterator::const_iterator(wxString const*, std::__1::__wrap_iter<char const*>) string.h:1010
wxString::end() const string.h:1395
wxString::length() const string.h:1434
wxString::Len() const string.h:1491
SCH_FIELD::IsVoid() const sch_field.h:118
KIGFX::SCH_PAINTER::draw(SCH_FIELD*, int) sch_painter.cpp:1192
KIGFX::SCH_PAINTER::draw(SCH_COMPONENT*, int) sch_painter.cpp:1165
KIGFX::SCH_PAINTER::Draw(KIGFX::VIEW_ITEM const*, int) sch_painter.cpp:204
KIGFX::VIEW::updateItemGeometry(KIGFX::VIEW_ITEM*, int) view.cpp:1317
KIGFX::VIEW::invalidateItem(KIGFX::VIEW_ITEM*, int) view.cpp:1247
KIGFX::VIEW::UpdateItems() view.cpp:1435
EDA_DRAW_PANEL_GAL::onPaint(wxPaintEvent&) draw_panel_gal.cpp:182
SCH_DRAW_PANEL::onPaint(wxPaintEvent&) sch_draw_panel.cpp:704
wxEvtHandler::SearchDynamicEventTable(wxEvent&) 0x000000010384a9de
wxEvtHandler::ProcessEventLocally(wxEvent&) 0x000000010384a75b
wxEvtHandler::ProcessEvent(wxEvent&) 0x000000010384a604
wxEvtHandler::ProcessPendingEvents() 0x000000010384a1be
wxAppConsoleBase::ProcessPendingEvents() 0x00000001036f2e97
wxCFEventLoop::OSXCommonModeObserverCallBack(__CFRunLoopObserver*, int, void*) 0x0000000103816372
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ 0x00007fff45b71e88
__CFRunLoopDoObservers 0x00007fff45b71dbd
__CFRunLoopRun 0x00007fff45b144d0
CFRunLoopRunSpecific 0x00007fff45b13e0e
RunCurrentEventLoopInMode 0x00007fff44e009db
ReceiveNextEventCommon 0x00007fff44e0061d
_BlockUntilNextEventMatchingListInModeWithFilter 0x00007fff44e004a6
_DPSNextEvent 0x00007fff4319affb
-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 0x00007fff43199d93
-[NSApplication run] 0x00007fff43193eb0
wxGUIEventLoop::OSXDoRun() 0x000000010317cedf
wxCFEventLoop::DoRun() 0x0000000103816cd1
wxEventLoopBase::Run() 0x0000000103738cc2
wxAppConsoleBase::MainLoop() 0x00000001036f2053
wxApp::OnRun() 0x000000010310fe1a
APP_KICAD::OnRun() kicad.cpp:267
wxEntry(int&, wchar_t**) 0x000000010377fe4a
main kicad.cpp:298
start 0x00007fff71f8c3d5
start 0x00007fff71f8c3d5

I can open kit-dev-coldfire-xilinx-5213 but crash trying to enter a sheet:
wxStringIteratorNode::DoSet(wxString const*, std::__1::__wrap_iter<char const*>*, std::__1::__wrap_iter<char*>*) string.h:4276
wxStringIteratorNode::wxStringIteratorNode(wxString const*, std::__1::__wrap_iter<char const*>*) string.h:365
wxStringIteratorNode::wxStringIteratorNode(wxString const*, std::__1::__wrap_iter<char const*>*) string.h:365
wxString::const_iterator::const_iterator(wxString const*, std::__1::__wrap_ite...

Read more...

Revision history for this message
Jon Evans (craftyjon) wrote :

@Michael G -- I fixed this assert in 3eef4bce, however without access to your full project (for the symbol libraries) I cannot check to make sure the connectivity is okay. Please check now and if you see any netlisting issues, could you please email me the whole project? If you cannot share, let me know and I'll help debug some othe rway.

@Michael K -- From your stack trace this looks unrelated -- are you able to bisect to a commit where the crash starts? I don't have my MacOS build environment working right now but I will try to fix it so that I can try to reproduce. I don't see these crashes on Linux or Windows.

Revision history for this message
Jeff Young (jeyjey) wrote :

The #5, #6 and #10 crashes look to be wxString's lack of support for multi-threading.

This usually comes up when a global string is referenced from a thread. Is the connection updating stuff threaded?

Revision history for this message
Jon Evans (craftyjon) wrote :

I bet the MacOS crash is similar to this actually: https://bugs.launchpad.net/kicad/+bug/1761450

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

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

Changed in kicad:
status: Triaged → Fix Committed
Revision history for this message
Jon Evans (craftyjon) wrote :

Jeff, I found the other bug before I read your comment :)
Yes, there is a thread used in connection updating

Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

Getting better! The crash in #5 still happens though but now its intermittent instead of every time.

Revision history for this message
Jon Evans (craftyjon) wrote :

Are the stack traces identical after 948a617?

Changed in kicad:
status: Fix Committed → In Progress
Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

@Jon, yes, but the crash is now intermittent.

Revision history for this message
Jeff Young (jeyjey) wrote :

This still fails: even if we use the mutex in Void(), some other accessor such as EDA_TEXT's GetText() method is going to sink us.

Are the multi-threaded routines small? Is there a way to isolate them from the SCH_FIELDs?

The (safe) alternative is to make EDA_TEXT's m_text a std::string. Needless to say, though, this change will have a long tail....

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

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

Changed in kicad:
status: In Progress → Fix Committed
assignee: Jon Evans (craftyjon) → Jeff Young (jeyjey)
Revision history for this message
Jeff Young (jeyjey) wrote :

I _claim_ to have fixed this. I added more mutex locks, and more importantly removed returning a reference from GetText() (which allows the resource to escape its RAII mutex locks).

Please test and re-open if it still crashes.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.