BZR4873 - pcbnew crashes when saving board

Bug #1321072 reported by madworm
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Critical
Maciej Suminski

Bug Description

This issue was introduced after 4865, which still works fine.

Reproduce:

* Change layer settings in gerber creation dialogue [plot] (e.g. deselect a layer for export)
* Save board

Result:

* fatal crash
* board file gets deleted from disk

---

Program received signal SIGSEGV, Segmentation fault.
0x00007fffdc603cae in BOARD::FindNet(wxString const&) const () from /usr/bin/_pcbnew.kiface
(gdb) backtrace
#0 0x00007fffdc603cae in BOARD::FindNet(wxString const&) const () from /usr/bin/_pcbnew.kiface
#1 0x00007fffdc615094 in BOARD::SynchronizeNetsAndNetClasses() () from /usr/bin/_pcbnew.kiface
#2 0x00007fffdc3b3102 in PCB_EDIT_FRAME::SavePcbFile(wxString const&, bool) () from /usr/bin/_pcbnew.kiface
#3 0x00007fffdc3b4c8e in PCB_EDIT_FRAME::Files_io(wxCommandEvent&) () from /usr/bin/_pcbnew.kiface
#4 0x00007ffff687a566 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
   from /usr/lib64/wx-2.8-stl/libwx_baseu-2.8.so.0
#5 0x00007ffff687aa03 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) ()
   from /usr/lib64/wx-2.8-stl/libwx_baseu-2.8.so.0
#6 0x00007ffff687aaf7 in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib64/wx-2.8-stl/libwx_baseu-2.8.so.0
#7 0x00007fffdc717e82 in EDA_BASE_FRAME::ProcessEvent(wxEvent&) () from /usr/bin/_pcbnew.kiface
#8 0x00007ffff687aa80 in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib64/wx-2.8-stl/libwx_baseu-2.8.so.0
#9 0x00007ffff703fc49 in wxWindowBase::TryParent(wxEvent&) () from /usr/lib64/wx-2.8-stl/libwx_gtk2u_core-2.8.so.0
#10 0x00007ffff79b4623 in wxAuiToolBar::OnLeftUp(wxMouseEvent&) () from /usr/lib64/wx-2.8-stl/libwx_gtk2u_aui-2.8.so.0
#11 0x00007ffff687a566 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
   from /usr/lib64/wx-2.8-stl/libwx_baseu-2.8.so.0
#12 0x00007ffff687aa03 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) ()
   from /usr/lib64/wx-2.8-stl/libwx_baseu-2.8.so.0
#13 0x00007ffff687aaf7 in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib64/wx-2.8-stl/libwx_baseu-2.8.so.0
#14 0x00007ffff6f47ee4 in ?? () from /usr/lib64/wx-2.8-stl/libwx_gtk2u_core-2.8.so.0
#15 0x00007ffff50609d5 in ?? () from /usr/lib64/libgtk-x11-2.0.so.0
#16 0x00007ffff4a34318 in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#17 0x00007ffff4a45cad in ?? () from /usr/lib64/libgobject-2.0.so.0
#18 0x00007ffff4a4d689 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#19 0x00007ffff4a4dc72 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#20 0x00007ffff5170864 in ?? () from /usr/lib64/libgtk-x11-2.0.so.0
#21 0x00007ffff505f184 in gtk_propagate_event () from /usr/lib64/libgtk-x11-2.0.so.0
#22 0x00007ffff505f53b in gtk_main_do_event () from /usr/lib64/libgtk-x11-2.0.so.0
#23 0x00007ffff4ccfa8c in ?? () from /usr/lib64/libgdk-x11-2.0.so.0
#24 0x00007ffff4217316 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#25 0x00007ffff4217668 in ?? () from /usr/lib64/libglib-2.0.so.0
#26 0x00007ffff4217a6a in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#27 0x00007ffff505e627 in gtk_main () from /usr/lib64/libgtk-x11-2.0.so.0
#28 0x00007ffff6f3528a in wxEventLoop::Run() () from /usr/lib64/wx-2.8-stl/libwx_gtk2u_core-2.8.so.0
#29 0x00007ffff6fc2aac in wxAppBase::MainLoop() () from /usr/lib64/wx-2.8-stl/libwx_gtk2u_core-2.8.so.0
#30 0x000000000042679b in _start ()

---

From time-to-time I also get error messages like this (also fatal)

*** Error in `pcbnew': corrupted double-linked list: 0x0000000004ade7a0 ***

I'm not 100% sure yet, but the error seems to occur if there are more netclasses than just the "Default" one.

Revision history for this message
madworm (madworm-de-inkscape) wrote :
summary: - BZR4872 - pcbnew crashes when saving board
+ BZR4873 - pcbnew crashes when saving board
Revision history for this message
madworm (madworm-de-inkscape) wrote :

Now I'm pretty certain that's it.

Adding a 2nd netclass to an old board that didn't show any issues before makes it go berserk too. The same thing happens after adding another NC to a new (empty) board.

Revision history for this message
madworm (madworm-de-inkscape) wrote :

Application: kicad
Version: (2014-05-19 BZR 4873)-product Release build
wxWidgets: Version 2.8.12 (release,Unicode,compiler with C++ ABI 1002,GCC 4.8.1,STL containers,compatible with 2.6)
Platform: Linux 3.11.10-7-desktop x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.54.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Revision history for this message
Lorenzo Marcantonio (l-marcantonio) wrote : Re: [Bug 1321072] [NEW] BZR4873 - pcbnew crashes when saving board

On Tue, May 20, 2014 at 02:48:06AM -0000, madworm wrote:
> * fatal crash
> * board file gets deleted from disk
^^^ Not fun !

> Program received signal SIGSEGV, Segmentation fault.
> 0x00007fffdc603cae in BOARD::FindNet(wxString const&) const () from /usr/bin/_pcbnew.kiface
> (gdb) backtrace
> #0 0x00007fffdc603cae in BOARD::FindNet(wxString const&) const () from /usr/bin/_pcbnew.kiface
> #1 0x00007fffdc615094 in BOARD::SynchronizeNetsAndNetClasses() () from /usr/bin/_pcbnew.kiface

*Could* be indirectly the changes I did to get track, looking into it.

--
Lorenzo Marcantonio
Logos Srl

Revision history for this message
Lorenzo Marcantonio (l-marcantonio) wrote :

On Tue, May 20, 2014 at 02:48:06AM -0000, madworm wrote:
> Public bug reported:
>
> This issue was introduced after 4865, which still works fine.

OK, found another way to reproduce, too. Plot options, changing
something and then close twice gives a segfault.

#0 0x00007ffff57048d4 in free () from /lib64/libc.so.6
#1 0x00007fffee5b7d08 in wxString::~wxString() ()
from /home/lomarcan/cvswork/kicad-vnd/pcbnew/_pcbnew.kiface
#2 0x00007fffee84578f in NETCLASS::~NETCLASS() ()
from /home/lomarcan/cvswork/kicad-vnd/pcbnew/_pcbnew.kiface
#3 0x00007fffee845e1f in NETCLASSES::Clear() ()
from /home/lomarcan/cvswork/kicad-vnd/pcbnew/_pcbnew.kiface
#4 0x00007fffee845e49 in NETCLASSES::~NETCLASSES() ()
from /home/lomarcan/cvswork/kicad-vnd/pcbnew/_pcbnew.kiface
#5 0x00007fffee5d0562 in
PCB_EDIT_FRAME::ToPlotter(wxCommandEvent&) ()
    from
    /home/lomarcan/cvswork/kicad-vnd/pcbnew/_pcbnew.kiface

A double free or some memory stomping?

I hoped it was from the GetTrack changes but these were in 4865... are
you sure thate 4866 already has the issue? Only eeschema changed in
it...

--
Lorenzo Marcantonio
Logos Srl

Revision history for this message
madworm (madworm-de-inkscape) wrote :

No, I'm not sure yet. I'm building 4868 now, which will take some time.

Revision history for this message
madworm (madworm-de-inkscape) wrote :

4868 doesn't seem to have this issue. It doesn't crash regularly when saving the board, as described above.

I do get apparently random segmentation fault crashes though. But I can't say if these are specific to 4868 or something else.

Changed in kicad:
importance: Undecided → Critical
Revision history for this message
Lorenzo Marcantonio (l-marcantonio) wrote : Re: [Bug 1321072] Re: BZR4873 - pcbnew crashes when saving board

On Tue, May 20, 2014 at 05:10:38AM -0000, madworm wrote:
> 4868 doesn't seem to have this issue. It doesn't crash regularly when
> saving the board, as described above.
>
> I do get apparently random segmentation fault crashes though. But I
> can't say if these are specific to 4868 or something else.

4869 does reproduce the plot dialog fault. Actually 4869 has some
changes to the NETCLASS classes, so these could be the problem.

--
Lorenzo Marcantonio
Logos Srl

Changed in kicad:
status: New → Triaged
assignee: nobody → Maciej Sumiński (orsonmmz)
status: Triaged → In Progress
Changed in kicad:
status: In Progress → Fix Committed
Revision history for this message
madworm (madworm-de-inkscape) wrote :

Gentlemen, well done!

Jon Neal (reportingsjr)
Changed in kicad:
status: Fix Committed → Fix Released
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.