Starting DRC crashes KiCad

Bug #1770414 reported by Tobias Kohler on 2018-05-10
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Critical
jean-pierre charras

Bug Description

In all my previous projects using KiCad the DRC always worked flawlessly. Recently I started a new project with KiCad and noticed that somehow starting a DRC in pcbnew almost immediately crashed KiCad. To rule out my suspicion that the DRC choked on my particular PCB design I created a new empty project. Unfortunately the DRC even crashed with an empty project. I was using KiCad 4.0.7

Next I emptied my .config/kicad directory and installed the KiCad 5 dev version from @kicad/kicad copr but the DRC crashes persisted.

To reproduce the crash it is enough to just open pcbnew without opening any file and click "Start DRC".

Terminal error message:
##################
/usr/include/c++/8/bits/stl_vector.h:932: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = D_PAD*; _Alloc = std::allocator<D_PAD*>; std::vector<_Tp, _Alloc>::reference = D_PAD*&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.

Version info
#########
Application: kicad
Version: 5.0.0-rc2-dev-unknown-r12889-dbc2eea3, debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.59.0 OpenSSL/1.1.0h zlib/1.2.11 libidn2/2.0.4 libpsl/0.20.2 (+libidn2/2.0.4) libssh/0.7.5/openssl/zlib nghttp2/1.31.1
Platform: Linux 4.16.6-302.fc28.x86_64 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.66.0
    Curl: 7.59.0
    Compiler: GCC 8.0.1 with C++ ABI 1012

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

Jeff Young (jeyjey) wrote :

Doesn't reproduce on Mac. Anyone manage it on Linux?

Seth Hillbrand (sethh) wrote :

Have not seen this behavior on Linux. Tobias, can you attach the project that is crashing?

Wayne Stambaugh (stambaughw) wrote :

I've tried several projects on Linux with various options checked and unchecked an I couldn't get it to crash. Maybe it's board specific. @Tobias, is it possible to attach the board that triggers the issue or at least test some of the KiCad demos and see if any of them trigger the issue.

Jeff Young (jeyjey) wrote :

Raising the importance while this gets researched.

(If we find out it only happens in rare circumstances or can't be reproduced then we can lower the importance or close it.)

Changed in kicad:
importance: Undecided → Critical
Tobias Kohler (i-lispeacs) wrote :
Download full text (8.7 KiB)

I have installed KiCad 4.0.7 on another Fedora 28 machine that never had KiCad installed before. Opening any of the demo projects from /usr/share/kicad/demos and starting DRC in pcbnew resulted in crashing with the same assertion failure as in my original message.

I also tested 5.0.0-rc2-dev with the KiCad demos and got the same assertion failure. Somehow this seems to be a problem specific to Fedora 28 and not board related. Previously I have been using KiCad 4.0.7 with Fedora 27 and I cannot remember any crashes at all.

coredumpctl info
################
Stack trace of thread 8108:
#0 0x00007f40849a7f4b raise (libc.so.6)
#1 0x00007f4084992591 abort (libc.so.6)
#2 0x00007f4042b827c8 n/a (_pcbnew.kiface)
#3 0x00007f4042df3271 n/a (_pcbnew.kiface)
#4 0x00007f4042df3594 n/a (_pcbnew.kiface)
#5 0x00007f4042bcc16f n/a (_pcbnew.kiface)
#6 0x00007f40879e5cf2 _ZN12wxEvtHandler23ProcessEventIfMatchesIdERK21wxEventTableEntryBasePS_R7wxEvent (libwx_baseu-3.0.so.0)
#7 0x00007f40879e609a _ZN12wxEvtHandler23SearchDynamicEventTableER7wxEvent (libwx_baseu-3.0.so.0)
#8 0x00007f40879e6134 _ZN12wxEvtHandler11TryHereOnlyER7wxEvent (libwx_baseu-3.0.so.0)
#9 0x00007f40879e61eb _ZN12wxEvtHandler19ProcessEventLocallyER7wxEvent (libwx_baseu-3.0.so.0)
#10 0x00007f40879e6281 _ZN12wxEvtHandler12ProcessEventER7wxEvent (libwx_baseu-3.0.so.0)
#11 0x00007f40879e601b _ZN12wxEvtHandler18SafelyProcessEventER7wxEvent (libwx_baseu-3.0.so.0)
#12 0x00007f40881decd7 wxgtk_button_clicked_callback (libwx_gtk2u_core-3.0.so.0)
#13 0x00007f4083ddbadd g_closure_invoke (libgobject-2.0.so.0)
#14 0x00007f4083dee9ae signal_emit_unlocked_R (libgobject-2.0.so.0)
#15 0x00007f4083df7fda g_signal_emit_valist (libgobject-2.0.so.0)
#16 0x00007f4083df85d3 g_signal_emit (libgobject-2.0.so.0)
#17 0x00007f4084372645 gtk_real_button_released.part.23 (libgtk-x11-2.0.so.0)
#18 0x00007f4083ddbadd g_closure_invoke (libgobject-2.0.so.0)
#19 0x00007f4083def056 signal_emit_unlocked_R (libgobject-2.0.so.0)
#20 0x00007f4083df7fda g_signal_emit_valist (libgobject-2.0.so.0)
#21 0x00007f4083df85d3 g_signal_emit (libgobject-2.0.so.0)
#22 0x00007f408437124c gtk_button_button_release (libgtk-x11-2.0.so.0)
#23 0x00007f408442c9ad _gtk_marshal_BOOLEAN__BOXED (libgtk-x11-2.0.so.0)
#24 0x00007f4083ddbadd g_closure_invoke (libgobject-2.0.so.0)
#25 0x00007f4083dee6e4 signal_emit_unlocked_R (libgobject-2.0.so.0)
#26 0x00007f4083df7653 g_signal_emit_valist (libgobject-2.0.so.0)
#27 0x00007f4083df85d3 g_signal_emit (libgobject-2.0.so.0)
#28 0x00007f40845608dc gtk_widget_event_internal (libgtk-x11-2.0.so.0)
#29 0x00007f408442a5cc gtk_propagate_event (libgtk-x11-2.0.so.0)
#30 0x00007f408442a9cb gtk_main_do_event (libgtk-x11-2.0.so.0)
#31 0x00007f408407ff00 gdk_event_dispatch (libgdk-x11-2.0.so.0)
#32 0x00007f40833517cd g_main_context_dispatch (libglib-2.0.so.0)
#33 0x00007f4083351b98 g_main_context_iterate.isra.21 (libglib-2.0.so.0)
#34 0x00007f4083351ec2 g_main_loop_run (libglib-2.0.so.0)
#35 0x00007f408442995f gtk_main (libgtk-x11-2.0.so.0)
#36 0x00007f408817fbd5 _ZN14wxGUIEventLoop5DoRunEv (libwx_gtk2u_core-3.0.so.0)
#37 0x00007f40878b7411 _ZN15wxEventLoopBase3RunEv (libwx_baseu-3.0.so.0)
#38 0x00007f408787b0da _Z...

Read more...

Tomasz Wlostowski (twlostow) wrote :

Tobias, can you send us (in PM) the PCB design or at least the _pcbnew.kiface file (so that we can find where the assertion gets triggered)?

Tom

Seth Hillbrand (sethh) wrote :

@Tobias- I just installed a brand-new Fedora 28 in a VM and cannot reproduce this crash with any of the demo projects.

Can you pull to the latest git, run yum update and try one more time? If it still happens, can you run 'yum list installed' and paste that info here?

Application: kicad
Version: (5.0.0-rc2-dev-736-g538ab0eb3-dirty), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.59.0 OpenSSL/1.1.0h zlib/1.2.11 libidn2/2.0.4 libpsl/0.20.2 (+libidn2/2.0.4) libssh/0.7.5/openssl/zlib nghttp2/1.32.0
Platform: Linux 4.16.7-300.fc28.x86_64 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.66.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.59.0
    Compiler: GCC 8.1.1 with C++ ABI 1012
Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=OFF

David (key1) wrote :

Hello,

I recently filed a bug against Fedora that seems similar to this one: https://bugzilla.redhat.com/show_bug.cgi?id=1577065

I believe that this behavior is due to Fedora 28's change to include D_GLIBCXX_ASSERTIONS by default in their RPM builds. Rebuilding the without that flag leads to a working DRC and no crash.

Tobias Kohler (i-lispeacs) wrote :

I built KiCad from https://git.launchpad.net/kicad and everything works. David is right.

Application: kicad
Version: (5.0.0-rc2-dev-736-g538ab0eb3), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.59.0 OpenSSL/1.1.0h zlib/1.2.11 libidn2/2.0.4 libpsl/0.20.2 (+libidn2/2.0.4) libssh/0.7.5/openssl/zlib nghttp2/1.32.0
Platform: Linux 4.16.8-300.fc28.x86_64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.22
    Boost: 1.66.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.59.0
    Compiler: GCC 8.1.1 with C++ ABI 1012

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

Could you test this patch against current RC2 branch?

It looks like D_GLIBCXX_ASSERTIONS=ON creates too zealous tests at run time.
This patch just calculate the same limit using a slightly different formula.

Tobias Kohler (i-lispeacs) wrote :

I built the RC2 branch with above patch applied and with D_GLIBCXX_ASSERTIONS enabled. DRC now works flawlessly for me.

KiCad Janitor (kicad-janitor) wrote :

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

Changed in kicad:
status: New → Fix Committed
assignee: nobody → jean-pierre charras (jp-charras)
Changed in kicad:
status: Fix Committed → Fix Released
Dejardin (mdj72) wrote :

Dear all
I encounter the same problem with FC28 and Kicad 4.0.7 from legacy yum repository.
Is there already an official kicad version with the bug fix or do I have to rebuild my own version of kicad ?
Thanks in advance
Best regards,
Marc

Maciej Suminski (orsonmmz) wrote :

There are nightly builds for Fedora, more details on the website [1]. Note that the current nightlies are based on a development branch that has recently introduced a lot of experimental changes, which may turn KiCad unstable. If you decide to build KiCad yourself, then I recommend checking out 5.0.0 tag.
We are very close to releasing stable 5.0, so if you do not feel adventurous, you may simply wait a few days.

1. http://kicad-pcb.org/download/fedora/

Dejardin (mdj72) wrote :

Many thanks !
I am trying 5.0.0-0.2-rc3.fc29 from rawhide repository.
DRC does not crash anymore.
Looking around in menus, I have found back the Open-GL setting to switch on the differential line routing.
I don't see obvious problem for the moment. I will let you know if I find some weird behavior.

Best regards
Marc

Dejardin (mdj72) wrote :

To be more precise : I can't wait few days... I have to submit the PCB for fabrication before August holidays.
Best regards
Marc

Nick Østergaard (nickoe) wrote :

Well, please be more specific. What version are you testing, does it include the fix?

Jeff Young (jeyjey) wrote :

@Dejardin, 5.0 RC3 is *very* close to the final release. You should be good-to-go with it.

Dejardin (mdj72) wrote :

I am using 5.0.0-rc3-0.2-rc3.fc29 from Fedora rawhide repository.
Marc

Dejardin (mdj72) wrote :

Many thanks to every body !
Very reactive community. At the level of this wonderful professional CAD tool.
Best regards
Marc

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

Other bug subscribers

Remote bug watches

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