eeschema: segmentation fault in "symbol properties>footprint"

Bug #1789626 reported by JKB
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Critical
Seth Hillbrand

Bug Description

Hello,

I have upgraded my git this morning and rebuild kicad from sources. I have noticed that kicad aborts with segfault when I open from eeschema "symbol properties" (in french "Propriétés du symbole") and I try to associate a footprint ("examen empreintes"). Segfault only occurs when value contains a inexistant footprint.

Best regards,

JKB

Application: eeschema
Version: (5.0.1-dev-59-g9527034e0-dirty), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.0 GnuTLS/3.5.19 zlib/1.2.11 libidn2/2.0.4 libpsl/0.20.2 (+libidn2/2.0.4) libssh2/1.8.0 nghttp2/1.32.0 librtmp/2.3
Platform: Linux 4.16.0-2-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.62.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.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_WXPYTHON=ON
    KICAD_SCRIPTING_ACTION_MENU=OFF
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Tags: eeschema
Changed in kicad:
importance: Undecided → Critical
tags: added: eeschema
Changed in kicad:
milestone: none → 5.1.0
Seth Hillbrand (sethh)
Changed in kicad:
assignee: nobody → Seth Hillbrand (sethh)
milestone: 5.1.0 → 5.0.1
Revision history for this message
Seth Hillbrand (sethh) wrote :

@JKB- I am unable to recreate this issue. But it looks like you have a mis-match between your compiled wxWidgets version (3.0.2) and your installed version (3.0.4). Can you re-build with a clean copy of KiCad and see if the issue still exists?

Revision history for this message
JKB (joel-bertrand) wrote :

@Seth. I don't understand why build info returns "wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24"

I have rebuild wxwidget from scratch (I run Debian/Buster and kicad doesn't support gtk3 if I remember) with wxWidgets-3.0.4.tar.bz2. But, indeed, I have build wxPython-src-3.0.2.0.tar.bz2.

hilbert:[/usr/local/bin] > ldd eeschema | grep wx
        libwx_gtk2u_gl-3.0.so.0 => /usr/local/lib/libwx_gtk2u_gl-3.0.so.0 (0x00007f1c1552b000)
        libwx_gtk2u_aui-3.0.so.0 => /usr/local/lib/libwx_gtk2u_aui-3.0.so.0 (0x00007f1c15497000)
        libwx_gtk2u_adv-3.0.so.0 => /usr/local/lib/libwx_gtk2u_adv-3.0.so.0 (0x00007f1c152c7000)
        libwx_gtk2u_html-3.0.so.0 => /usr/local/lib/libwx_gtk2u_html-3.0.so.0 (0x00007f1c151f1000)
        libwx_gtk2u_core-3.0.so.0 => /usr/local/lib/libwx_gtk2u_core-3.0.so.0 (0x00007f1c14bb9000)
        libwx_baseu_net-3.0.so.0 => /usr/local/lib/libwx_baseu_net-3.0.so.0 (0x00007f1c14b70000)
        libwx_baseu-3.0.so.0 => /usr/local/lib/libwx_baseu-3.0.so.0 (0x00007f1c148d4000)
        libwx_baseu_xml-3.0.so.0 => /usr/local/lib/libwx_baseu_xml-3.0.so.0 (0x00007f1c148c2000)
        libwx_gtk2u_stc-3.0.so.0 => /usr/local/lib/libwx_gtk2u_stc-3.0.so.0 (0x00007f1c14686000)

All these libraries come from wxwidgets 3.0.4.

Regards,

JKB

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

Unless you set -DwxWidgets_ROOT_DIR during configuration, `wx-config --version` will tell you which version of wxWidgets you are current building against.

Revision history for this message
Seth Hillbrand (sethh) wrote :

@JKB- In addition to Wayne's comment, can you show the output of `ldd pcbnew | grep wx`?

Revision history for this message
Fabián Inostroza (fabianinostroza) wrote :

I noticed something similar yesterday but after that I was unable to reproduce it. One other thing that I remember is that I got a warning about a symbol alias not defined when loading the schematic. That dialog doesn't show up anymore and I haven't modified any files in the project directory.

Revision history for this message
JKB (joel-bertrand) wrote : Re: [Bug 1789626] Re: eeschema: segmentation fault in "symbol properties>footprint"

Seth Hillbrand a écrit :
> @JKB- In addition to Wayne's comment, can you show the output of `ldd
> pcbnew | grep wx`?
>

hilbert:[~/datasheets/circuits] > ldd /usr/local/bin/pcbnew | grep wx
        libwx_gtk2u_gl-3.0.so.0 =>
/usr/local/lib/libwx_gtk2u_gl-3.0.so.0 (0x00007f3df9a9a000)
        libwx_gtk2u_aui-3.0.so.0 =>
/usr/local/lib/libwx_gtk2u_aui-3.0.so.0 (0x00007f3df9a06000)
        libwx_gtk2u_adv-3.0.so.0 =>
/usr/local/lib/libwx_gtk2u_adv-3.0.so.0 (0x00007f3df9836000)
        libwx_gtk2u_html-3.0.so.0 =>
/usr/local/lib/libwx_gtk2u_html-3.0.so.0 (0x00007f3df9760000)
        libwx_gtk2u_core-3.0.so.0 =>
/usr/local/lib/libwx_gtk2u_core-3.0.so.0 (0x00007f3df9128000)
        libwx_baseu_net-3.0.so.0 =>
/usr/local/lib/libwx_baseu_net-3.0.so.0 (0x00007f3df90df000)
        libwx_baseu-3.0.so.0 => /usr/local/lib/libwx_baseu-3.0.so.0
(0x00007f3df8e43000)
        libwx_baseu_xml-3.0.so.0 =>
/usr/local/lib/libwx_baseu_xml-3.0.so.0 (0x00007f3df8e31000)
        libwx_gtk2u_stc-3.0.so.0 =>
/usr/local/lib/libwx_gtk2u_stc-3.0.so.0 (0x00007f3df8bf5000)

 Best regards,

 JKB

Revision history for this message
JKB (joel-bertrand) wrote :

Wayne Stambaugh a écrit :
> Unless you set -DwxWidgets_ROOT_DIR during configuration, `wx-config
> --version` will tell you which version of wxWidgets you are current
> building against.

 Of course, I have set -DwxWidgets_ROOT_DIR to build kicad against
wxWidgets I have built in /usr/local.

 I don't understand why wx-config --version returns 3.0.2. I have only
built 3.0.4 against gtk2.

 To obtain a segfault, I have opened a schematic written with kicad
4.0.7. Footprint libraries have changed and segfault occurs when I try
to modify footprint by "symbol proprties". If I clear "value" before
trying to modify footprint, kicad runs as expected.

 Best regards,

 JKB

Revision history for this message
Seth Hillbrand (sethh) wrote :

Are you able to compile a debug version and obtain a back trace using gdb?

Revision history for this message
JKB (joel-bertrand) wrote :
Download full text (4.0 KiB)

Seth Hillbrand a écrit :
> Are you able to compile a debug version and obtain a back trace using
> gdb?

 I have analyzed core file with gdb.

Backtrace :
Core was generated by `kicad'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fd15f5f7e80 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
[Current thread is 1 (Thread 0x7fd15830eac0 (LWP 10009))]
(gdb) bt
#0 0x00007fd15f5f7e80 in () at
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#1 0x00007fd15f6013f5 in g_signal_emit_valist ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#2 0x00007fd15f601e0f in g_signal_emit ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#3 0x00007fd15f5ea424 in () at
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#4 0x00007fd15f5ec7f9 in g_object_notify ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5 0x00007fd16039797a in gtk_window_set_mnemonics_visible ()
    at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#6 0x00007fd160397c2a in () at
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#7 0x00007fd1601f234a in () at
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#8 0x00007fd15f5e5f6d in g_closure_invoke ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9 0x00007fd15f5f8e0e in () at
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007fd15f6013f5 in g_signal_emit_valist ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#11 0x00007fd15f601e0f in g_signal_emit ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#12 0x00007fd16038758e in gtk_widget_map ()
    at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#13 0x00007fd160391939 in () at
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#14 0x00007fd15f5e5f6d in g_closure_invoke ()
#15 0x00007fd15f5f8e0e in () at
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#16 0x00007fd15f6013f5 in g_signal_emit_valist ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#17 0x00007fd15f601e0f in g_signal_emit ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#18 0x00007fd160386b56 in gtk_widget_show ()
    at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#19 0x00007fd1601f3358 in gtk_dialog_run ()
    at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#20 0x00007fd1627a1f13 in wxMessageDialog::ShowModal() ()
    at /usr/local/lib/libwx_gtk2u_core-3.0.so.0
#21 0x00007fd1626e3fb5 in wxMessageBox(wxString const&, wxString const&,
long, wxWindow*, int, int) () at /usr/local/lib/libwx_gtk2u_core-3.0.so.0
#22 0x00007fd162935b2b in wxLogGui::Flush() ()
    at /usr/local/lib/libwx_gtk2u_core-3.0.so.0
#23 0x00007fd1622cd821 in wxLog::SetActiveTarget(wxLog*) ()
    at /usr/local/lib/libwx_baseu-3.0.so.0
#24 0x00007fd1622be378 in wxEntryCleanup() ()
    at /usr/local/lib/libwx_baseu-3.0.so.0
#25 0x00007fd14c8fe128 in __wxPyCleanup() () at src/helpers.cpp:771
#26 0x00007fd14c9b8af5 in wxApp_CleanUp() () at src/gtk/_core_wrap.cpp:4113
#27 0x00007fd14c9b8b25 in _wrap_App_CleanUp(PyObject*, PyObject*)
(args=<optimized out>) at src/gtk/_core_wrap.cpp:35552
#28 0x00007fd1549548cd in PyEval_EvalFrameEx ()
    at /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#29 0x00007fd15494df52 in PyEval_EvalCodeEx ()
    at /usr/lib/x86_64-linux-gnu/libpython2.7.so...

Read more...

Revision history for this message
Seth Hillbrand (sethh) wrote :

@JKB- If you utilize a compiling cache such as ccache, can you clear the cache or disable it, re-run cmake in a new directory and re-build?

The backtrace shows that KiCad is trying to exit and segfaulting on log cleanup. But since you are not trying to exit, this looks like the events are getting mixed up.

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

Hi,

@JKB could you check if commit b167c41d1b works for you?

I have a similar issue when I open the footprint browser from within the symbol editor and git bisect came up with commit 7e2e39ce304.

The current master shows a dialog with a warning (I do not remember the message) before opening the browser (it does not crash).

I was about to write a bug report but I think it might be the same issue.

Backtrace:
0 0x00007ffff43ae820 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#1 0x00007ffff43b7d5c in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#2 0x00007ffff43b808f in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#3 0x00007ffff49ecdb0 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#4 0x00007ffff43a3748 in g_object_run_dispose () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5 0x00007ffff6dc2cf2 in wxWindow::~wxWindow (this=0xc49ec00, __in_chrg=<optimized out>) at ../src/gtk/window.cpp:2530
#6 0x00007ffff6e58b97 in wxControl::~wxControl (this=0xc49ec00, __in_chrg=<optimized out>) at ../include/wx/gtk/control.h:20
#7 wxStaticTextBase::~wxStaticTextBase (this=0xc49ec00, __in_chrg=<optimized out>) at ../include/wx/stattext.h:31
#8 wxStaticText::~wxStaticText (this=0xc49ec00, __in_chrg=<optimized out>) at ../include/wx/gtk/stattext.h:16
#9 wxStaticText::~wxStaticText (this=0xc49ec00, __in_chrg=<optimized out>) at ../include/wx/gtk/stattext.h:16
#10 0x00007ffff6fafd17 in wxWindowBase::Destroy (this=this@entry=0xc49ec00) at ../src/common/wincmn.cpp:576
#11 0x00007ffff6fafd55 in wxWindowBase::DestroyChildren (this=this@entry=0x7fffffffbd10) at ../src/common/wincmn.cpp:608
#12 0x00007ffff6dc2c83 in wxWindow::~wxWindow (this=0x7fffffffbd10, __in_chrg=<optimized out>) at ../src/gtk/window.cpp:2506
#13 0x00007fffe6020840 in DIALOG_SHIM::~DIALOG_SHIM (this=0x7fffffffbd10, __in_chrg=<optimized out>) at /data/src/kicad-source-mirror/common/dialog_shim.cpp:93
#14 0x00007fffe5d1f03f in DIALOG_LIB_EDIT_TEXT_BASE::~DIALOG_LIB_EDIT_TEXT_BASE (this=0x7fffffffbd10, __in_chrg=<optimized out>) at /data/src/kicad-source-mirror/eeschema/dialogs/dialog_lib_edit_text_base.cpp:140
#15 0x00007fffe5cf116c in DIALOG_EDIT_ONE_FIELD::~DIALOG_EDIT_ONE_FIELD (this=0x7fffffffbd10, __in_chrg=<optimized out>) at /data/src/kicad-source-mirror/eeschema/./dialogs/dialog_edit_one_field.h:53
#16 0x00007fffe5cf12ea in DIALOG_LIB_EDIT_ONE_FIELD::~DIALOG_LIB_EDIT_ONE_FIELD (this=0x7fffffffbd10, __in_chrg=<optimized out>) at /data/src/kicad-source-mirror/eeschema/./dialogs/dialog_edit_one_field.h:131
#17 0x00007fffe5e37e8b in LIB_EDIT_FRAME::EditField (this=0x1fa25c0, aField=0xc4955a0) at /data/src/kicad-source-mirror/eeschema/libfield.cpp:60
#18 0x00007fffe5e2c37d in LIB_EDIT_FRAME::Process_Special_Functions (this=0x1fa25c0, event=...) at /data/src/kicad-source-mirror/eeschema/lib_edit_frame.cpp:912
#19 0x00007ffff648736e in wxAppConsoleBase::CallEventHandler (this=0x824730, handler=0x1fa25c0, functor=..., event=...) at ../src/common/appbase.cpp:623
#20 0x00007ffff660d4d7 in wxEvtHandler::ProcessEventIfMatchesId (entry=..., handler=<optimized out>, event=...) at ../src/common/event.cpp:1390
#...

Read more...

Revision history for this message
JKB (joel-bertrand) wrote :

Michael Geselbracht a écrit :
> Hi,
>
> @JKB could you check if commit b167c41d1b works for you?
>
> I have a similar issue when I open the footprint browser from within the
> symbol editor and git bisect came up with commit 7e2e39ce304.
>
> The current master shows a dialog with a warning (I do not remember the
> message) before opening the browser (it does not crash).

Hello,

How can I check this commit ? I dont know git enough to apply this
commit on 5.0 branch :-(

Other question on another bug. I have proposed a patch to fix another
bug (https://bugs.launchpad.net/kicad/+bug/1787902). Can somebody test
and apply in repository ?

Regards,

JKB

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

Hi,

in order to check out a specific commit you can use 'git checkout <commit-id>'.

So in this case the command would be:

git checkout b167c41d1b

You will probably get a warning about not being on a branch or something
but you can ignore that in this case. If you have cloned the repository with
the --depth= option you may not have this specific commit.

Once you are finished with compiling/testing

git checkout 5.0

will bring you back to the 5.0 branch.

 - Michael

Revision history for this message
JKB (joel-bertrand) wrote :

Michael Geselbracht a écrit :
> Hi,
>
> in order to check out a specific commit you can use 'git checkout
> <commit-id>'.
>
> So in this case the command would be:
>
> git checkout b167c41d1b
>
> You will probably get a warning about not being on a branch or something
> but you can ignore that in this case. If you have cloned the repository with
> the --depth= option you may not have this specific commit.
>
>
> Once you are finished with compiling/testing
>
> git checkout 5.0
>
> will bring you back to the 5.0 branch.

 OK, I have rebuilt kicad with this patch. This patch seems to fix this
issue. I only have in console :

/home/bertrand/git/kicad/eeschema/sch_edit_frame.cpp(619): assert
"m_undoItem != __null" failed in SaveUndoItemInUndoList(): Cannot swap
undo item structures. Bad programmer!.

but no segfault.

 Best regards,

 JKB

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

Ok, then I assume that this is indeed the same issue and I was able to reproduce the crash from eeschma.

The crash occurs when the library cannot be found. An non-existing symbol in an existing library does not lead to a crash.

Steps to reproduce 1
1. Open an existing schematics, move cursor over a symbol with assigned FP and press 'e'
2. Click on 'Footprint' in the 'Fields' table and change the library part of the FP into something non-existent.
  e.g. 'Package_QFP:LQFP-64...' into 'ackage_QFP:LQFP-64...'
3. Press 'Browse Footprints' -> crash

Steps to reproduce 2
1. Open symbol library editor
2. Open symbol 'Relay:FINDER-30.22'
3. Move cursor over FP Text 'Relay_THT:Relay_DPDT...' and press 'e'
4. Change Text into 'elay_THT:Relay_THT:Relay_DPDT...'
5. Press 'Select' -> crash

Revision history for this message
Seth Hillbrand (sethh) wrote :

Thank you for the clear steps! This helps

Revision history for this message
Seth Hillbrand (sethh) wrote :

Hmm... Janitor doesn't seem to be picking up the commit. This is 5.0 branch only as the loading is handled differently in 5.1. Fixed in ee12fe6ef

https://git.launchpad.net/kicad/commit/?id=ee12fe6eff373be3d6be126086203d67c0fd3211

Changed in kicad:
status: New → Fix Committed
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.