Pcbnew crash message, how to read

I am having pcbnew crash on startup. It crashes when run stand alone
and when run from kicad or eschema. This is the message that I get:

------------------------------------------------------------------
(pcbnew:2637160): Gdk-ERROR **: 22:34:01.548: The program 'pcbnew' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
  (Details: serial 354 error_code 2 request_code 151 (GLX) minor_code 24)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
Trace/breakpoint trap (core dumped)
-----------------------------------------------------

This is the KiCAD version information:

-----------------------------------------------------
Application: KiCad
Version: 5.1.10-88a1d61d58~88~ubuntu20.04.1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Platform: Linux 5.8.0-50-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
    Boost: 1.71.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.68.0
    Compiler: GCC 9.3.0 with C++ ABI 1013

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

------------------------------------------

I am running on Ubuntu 20.04.

This setup had been running OK. I then set aside my KiCAD work
to work on other stuff for about 1 week. During that time I
installed a few unrelated apps. When I came back to KiCAD
I get this crash.

I can run a new install of Ubuntu 20.04 with KiCAD in VirtualBox
VM on the same project with no problem.

What happened? Is it a possible library conflict? Where to start
looking?

The Gdk error is not the issue wxwidgets has lots of gdk bugs that spew those errors.

To get a meaningful info as to where the fault lies run kicad or pcbnew with gdb

gdb kicad
> run
(after crash)
> backtrace

And copy paste what gdb prints out at that point also when the crash happens a message should appear in gdb as to what caused the crash (the most common one is invalid memory access).

If things worked fine earlier then the crash is likely introduced in 5.1.10 which was recently pushed to ppa.

OK, here is what I get:

gdb pcbnew
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright © 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type “show copying” and “show warranty” for details.
This GDB was configured as “x86_64-linux-gnu”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type “help”.
Type “apropos word” to search for commands related to “word”…
Reading symbols from pcbnew…
(No debugging symbols found in pcbnew)
(gdb) r
Starting program: /usr/bin/pcbnew
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/x86_64-linux-gnu/libthread_db.so.1”.
[New Thread 0x7ffff461e700 (LWP 2820485)]
[New Thread 0x7ffff3e1d700 (LWP 2820486)]
[Detaching after vfork from child process 2820487]
[Detaching after vfork from child process 2820489]
[Detaching after vfork from child process 2820491]
[Detaching after vfork from child process 2820493]
[Detaching after vfork from child process 2820495]
[Detaching after vfork from child process 2820497]
[Detaching after vfork from child process 2820499]
[Detaching after vfork from child process 2820501]

(pcbnew:2820481): Gdk-ERROR **: 06:47:35.455: The program ‘pcbnew’ received an X Window System error.
This probably reflects a bug in the program.
The error was ‘BadValue (integer parameter out of range for operation)’.
(Details: serial 354 error_code 2 request_code 151 (GLX) minor_code 24)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)

Thread 1 “pcbnew” received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff6393295 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0 0x00007ffff6393295 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1 0x00007ffff6395c7c in g_log_writer_default () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007ffff6393ed7 in g_log_structured_array () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007ffff6394904 in g_log_structured_standard () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007ffff66dacea in ?? () from /lib/x86_64-linux-gnu/libgdk-3.so.0
#5 0x00007ffff66e7d13 in ?? () from /lib/x86_64-linux-gnu/libgdk-3.so.0
#6 0x00007ffff623d0db in _XError () from /lib/x86_64-linux-gnu/libX11.so.6
#7 0x00007ffff6239e47 in ?? () from /lib/x86_64-linux-gnu/libX11.so.6
#8 0x00007ffff6239ee5 in ?? () from /lib/x86_64-linux-gnu/libX11.so.6
#9 0x00007ffff623ae6d in _XReply () from /lib/x86_64-linux-gnu/libX11.so.6
#10 0x00007ffff6236641 in XSync () from /lib/x86_64-linux-gnu/libX11.so.6
#11 0x00007fffe95a1a68 in ?? () from /lib/x86_64-linux-gnu/libGLX_nvidia.so.0
#12 0x00007fffe9594de8 in glXCreateNewContext () from /lib/x86_64-linux-gnu/libGLX_nvidia.so.0
#13 0x00007ffff12641d8 in glXCreateNewContext () from /lib/x86_64-linux-gnu/libGLX.so.0
#14 0x00007ffff1d208df in wxGLContext::wxGLContext(wxGLCanvas*, wxGLContext const*) () from /lib/x86_64-linux-gnu/libwx_gtk3u_gl-3.0.so.0
#15 0x00007ffff2b5f072 in ?? () from /usr/bin/_pcbnew.kiface
#16 0x00007ffff2b83aa2 in ?? () from /usr/bin/_pcbnew.kiface
#17 0x00007ffff2b844f2 in ?? () from /usr/bin/_pcbnew.kiface
–Type for more, q to quit, c to continue without paging–
#18 0x00007ffff2b5dfa1 in ?? () from /usr/bin/_pcbnew.kiface
#19 0x00007ffff288dce3 in ?? () from /usr/bin/_pcbnew.kiface
#20 0x00007ffff242a807 in ?? () from /usr/bin/_pcbnew.kiface
#21 0x00007ffff20c0acb in ?? () from /usr/bin/_pcbnew.kiface
#22 0x000055555558edfd in ?? ()
#23 0x0000555555582cb4 in ?? ()
#24 0x0000555555586101 in ?? ()
#25 0x00007ffff759d79a in wxEntry(int&, wchar_t**) () from /lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#26 0x000055555558043c in ?? ()
#27 0x00007ffff6f4f0b3 in __libc_start_main (main=0x555555580410, argc=1, argv=0x7fffffffe0d8, init=, fini=, rtld_fini=,
stack_end=0x7fffffffe0c8) at …/csu/libc-start.c:308
#28 0x00005555555825de in _start ()
(gdb)

Make also sure that all your system is up to date. This seems to be something with wxWidgets, gtk, OpenGL, NVidia… IIRC at least once the same Gdk-ERROR was fixed for me by updating the system.

I did these:

apt update

apt upgrade

But I get the same error from pcbnew.

It’s a good time to take this gdb output to a bug report on gitlab. You will have much more chances to get resolution there.

You are probably right. I had hoped for a “you did something
stupid, do this to fix it” type of answer.

This may sound stupid, but have you rebooted after the latest changes to the system and KiCad? Due to how Linux updates work, there may be mismatch between already loaded binaries and updated binaries in the disk. It mostly works but it’s not 100% foolproof.

1 Like

This kind of crash I get when running any OpenGL app (not just KiCad) after updating my graphics drivers or other related parts of the system but not restarting afterwards.

I needed to update my Nvidia video driver. I had updated some libraries
which apparently required the latest Nvidia driver.

Now everything is working OK.

2 Likes