Pcbnew: Crash using external action plugin

Bug #1783634 reported by Sebastian
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Undecided
Maciej Suminski

Bug Description

Hello,

Steps to reproduce:

 - add a action script (for example https://github.com/MitjaNemec/Kicad_action_plugins replicate layout and https://github.com/jsreynaud/kicad-action-scripts via stitching) to the folder ~/.kicad_plugin

 - open pcbnew

 - refresh external plugins

 -> crash

I am using (installed via reynauds ppa):

Application: kicad
Version: 5.0.0-fee4fd1~65~ubuntu18.04.1, release 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-29-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_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

I tried the replication script with 5rc2 (I think) and it worked then.

I don't know too much about the plugin structure so I thought I'd report it here, although it could be because KICAD_SCRIPTING_WXPYTHON=OFF.

Probably interesting:
kicad[5804]: segfault at 0 ip 00007fb27519dbb7 sp 00007ffe7c5e36b0 error 4 in libwx_gtk3u_core-3.0.so.0.4.0[7fb274d92000+5a2000]

https://bugs.launchpad.net/kicad/+bug/1762432 #24 seems to have the same problem.
Also reported here https://github.com/jsreynaud/kicad-action-scripts/issues/5

Revision history for this message
Sebastian (herostrat) wrote :
Download full text (14.0 KiB)

I am new to debugging ths kind of stuff, but anyway here is the stacktrace (the part I think is interesting)

stat("/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_misc_", 0x7ffc1b10f2c0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_misc_.x86_64-linux-gnu.so", O_RDONLY) = 14
fstat(14, {st_mode=S_IFREG|0644, st_size=1197800, ...}) = 0
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_misc_.x86_64-linux-gnu.so", O_RDONLY|O_CLOEXEC) = 15
read(15, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\f\3\0\0\0\0\0"..., 832) = 832
fstat(15, {st_mode=S_IFREG|0644, st_size=1197800, ...}) = 0
mmap(NULL, 3300280, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 15, 0) = 0x7f1a56c15000
mprotect(0x7f1a56d25000, 2097152, PROT_NONE) = 0
mmap(0x7f1a56f25000, 81920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 15, 0x110000) = 0x7f1a56f25000
mmap(0x7f1a56f39000, 7096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f1a56f39000
close(15) = 0
mprotect(0x7f1a56f25000, 8192, PROT_READ) = 0
brk(0x55dbf05da000) = 0x55dbf05da000
close(14) = 0
brk(0x55dbf05fe000) = 0x55dbf05fe000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1a60763000
close(13) = 0
close(12) = 0
brk(0x55dbf0622000) = 0x55dbf0622000
brk(0x55dbf065e000) = 0x55dbf065e000
close(11) = 0
stat("/home/sebastian/.kicad_plugins/replicate_layout/pcbnew", 0x7ffc1b1101e0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/sebastian/.kicad_plugins/replicate_layout/pcbnew.x86_64-linux-gnu.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/sebastian/.kicad_plugins/replicate_layout/pcbnew.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/sebastian/.kicad_plugins/replicate_layout/pcbnewmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/sebastian/.kicad_plugins/replicate_layout/pcbnew.py", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/sebastian/.kicad_plugins/replicate_layout/pcbnew.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/sebastian/.kicad_plugins/replicate_layout/replicatelayout", 0x7ffc1b1101e0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/sebastian/.kicad_plugins/replicate_layout/replicatelayout.x86_64-linux-gnu.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/sebastian/.kicad_plugins/replicate_layout/replicatelayout.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/sebastian/.kicad_plugins/replicate_layout/replicatelayoutmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/sebastian/.kicad_plugins/replicate_layout/replicatelayout.py", O_RDONLY) = 11
fstat(11, {st_mode=S_IFREG|0664, st_size=37033, ...}) = 0
openat(AT_FDCWD, "/home/sebastian/.kicad_plugins/replicate_layout/repl...

Sebastian (herostrat)
description: updated
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Hi Sebastian,

I am almost sure that the crash is caused by different toolkits used by wxWidgets (GTK2) and wxPython (GTK3) libraries. KiCad normally uses wxWidgets/GTK2 set, as we have noticed many issues with wxWidgets/GTK3. The main goal for 5.1 release is to fix GTK3 issues, so we can restore the Python scripting interface.

tags: added: python
Revision history for this message
Sebastian (herostrat) wrote :

Thanks for all the help.
The reason it does not work is as stated the the wxWidgets stuff.

My current workaround is to use the CLI versions of the tools.

Because the bug is already known and reported I think we can close it for a better overview.

Changed in kicad:
status: New → In Progress
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

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

Changed in kicad:
status: In Progress → Fix Committed
assignee: nobody → Maciej Suminski (orsonmmz)
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