Hang when searching symbol libraries for "fl"

Bug #1767848 reported by Reece Pollack
24
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Critical
Maciej Suminski

Bug Description

Procedure to recreate:
 1) Open an KiCad project
 2) Open a schematic
 3) Hit "a" to add a component
 4) In the "Choose Symbol" dialog, start typing "flash" (without the quotes)
 5) After entering "fl" the "Flir_LEPTON" device from the "Sensor_Optical" library will be offered

At this point KiCad will hang. And it's repeatable!!

Other search strings don't seem to have the same problem. Every other search targets I've tried has worked successfully, but "fl" causes it to hang.

It looks like the primary thread is running at 100% CPU. There are two other threads, but they're idle. There's a partial screenshot, a GDB backtrace, and copies of the Sensor_Optical libraries in an attached Zip file.

Built from sources on a private branch descended from this git commit:
    7b73455 Make sure pin-caches are up-to-date before testing dangling ends.

Application: kicad
Version: (5.0.0-rc2-dev-612-g95cab3e), debug build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Platform: Linux 4.13.0-38-generic 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.58.0
    Curl: 7.47.0
    Compiler: GCC 5.4.0 with C++ ABI 1009

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_SPICE=ON

Revision history for this message
Reece Pollack (reece-pollack) wrote :
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Reece,

I cannot reproduce the freeze with c8a78405. Can you check if other libraries play a role here? Does eeschema freeze when there is only Sensor_Lib in sym-lib-table? Could your private changes might be related to the problem?

Changed in kicad:
milestone: none → 5.0.0-rc2
Revision history for this message
Reece Pollack (reece-pollack) wrote :

If I un-tick the Sensor_Optical library from the Sensor Library list in Eeschema, it no longer locks up. If I then tick Sensor_Optical again, it will lock up again.

I'm using the libraries from the kicad-symbols Git repo, master branch, currently at this commit:
    9a6465e Merge pull request #561 from poeschlr/fix_fp_pwr_superw

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

@Reece, do you have the footprint viewer in the symbol chooser dialog enabled? I cannot duplicate this bug on Windows 10 using kicad 2f5fdcf32.

Revision history for this message
Reece Pollack (reece-pollack) wrote :

Is there a footprint viewer in the symbol chooser dialog? Or do you mean the symbol previewer window?

I attached a Zip file in Comment #1 containing three files (and a bunch of layers of directories -- sorry!). One of them is a screen shot of the Choose Symbol dialog taken while KiCad was locked up. Maybe that will answer your question.

You might also want to look at the backtrace (stack dump) also included in the Zip file. It may tell you what KiCad was trying to do while it was hung.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

One can enable a footprint viewer in the symbol chooser dialog, but looking at your screenshot it is disabled. I have tried reproducing the problem using the exact kicad-symbols commit, but no luck. The backtrace does not say much, it looks the program is stuck somewhere in the wxWidgets event loop.

I am trying to recreate your environment, hoping it will let me see the problem. If you have only KiCad libraries in the symbol library table, could you attach sym-lib-table file? I suppose you can observe the problem with empty schematics sheet?

Changed in kicad:
status: New → Incomplete
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Reece, could you check if it still a problem? I need to know whether we should spend time trying to reproduce the issue.

Revision history for this message
Volker (volkimel) wrote :

Hello!

First of all, KiCAD is a great piece of software. Thanks for it and keep up the good work!
I have been doing some project with it already and it worked a treat.
So, I want to contribute a little bit as well, and that's why I signed up here. Just to report this error under similar conditions as well.
It's my first post and I hope it's ok to post it under here.

The same behavior happens to me when I start typing "ze" (in search for an ZEner diode).
If I have all libs enabled, the "Choose Symbol" dialog shows ZXCT1009F first (after "z") and then (after typing "e") shows ZETA-433-SO in the symbol list.
But the details and the symbol preview are still stuck with ZXCT1009F and KiCAD hangs.

I also tried with only the relevant lib "RF_AM_FM" enabled and it seems to work at first. However, if I then use the up-/down-keys to go to the lib group, the preview is disabled and if I want to go back down onto ZETA-433-SO, it hangs again.

It's consistent and repeatable across several nightly builds that I had over time.

Hopefully this might help in finding a problem.

Application: kicad
Version: (5.0.0-rc2-dev-28-g5f578c8), release build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Platform: Linux 4.16.0-041600-generic 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.58.0
    Curl: 7.47.0
    Compiler: GCC 5.4.0 with C++ ABI 1009

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_SPICE=ON

Revision history for this message
Jeff Young (jeyjey) wrote :

Reece's stack trace indicates it hangs when refreshing the window. The fact that Volker's screen dump shows the list updated but the preview and status box not-yet-updated suggests the same.

Both reporters are using GTK.

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

Hi Volker-

Can you tell us what distribution you use and how you installed KiCad? It will help to recreate the issue.

Revision history for this message
Volker (volkimel) wrote :

Hi!
Details from my System Info are attached.
Also information from "Software Sources" and the "Update history".

Changed in kicad:
milestone: 5.0.0-rc2 → 5.0.0-rc3
Revision history for this message
Reece Pollack (reece-pollack) wrote :

Yes, this is still a problem.

I can't recreate it using "ze" for a search string, but I can with "fl" as I originally reported. Un-ticking the Sensor_Optical library in the library list hides the problem for me.

I'm not quite current. I'm running code derived from this commit:

    3a8a718 A pesky bug, this one is. (Said in best Yoda impression.)

Revision history for this message
Reece Pollack (reece-pollack) wrote :

One bit of commonality I share with Volker is that we're both running Linux Mint 18.2.

However, he's running the Cinnamon desktop while I run KDE. He's also running a packaged nightly build while I'm running code I built from sources.

Revision history for this message
Reece Pollack (reece-pollack) wrote :

I'm using the symbol libraries from the kicad-symbols repo rather than any packaged in the PPA, and I removed the v4 installation when I started with v5. I haven't updated the symbol library repo in a while:

   9a6465e Merge pull request #561 from poeschlr/fix_fp_pwr_superw

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

I just tested this on Debian stable with symbol library commit 9a6465e and it worked fine for me.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I have just tested a nightly PPA package 2cb65f9 on a virtual machine running Linux Mint 18.2, no issues. No problems with 94f161b8 running on Arch Linux either. For the test I used the kicad-symbols repository @ 9a6465e, as mentioned in post #3.

Could you check if the problem persists if your Symbol Library Table contains *only* the library that eeschema freezes on? If eeschema does not freeze when only one library is loaded, then please post your sym-lib-table file (normally located in ~/.config/kicad).

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Tested also a self-built binary (94f161b8) on the same virtual machine, still no issues.

Revision history for this message
Volker (volkimel) wrote :

Hi!
I was already writing up a whole very detailed trace of what I was doing and what I saw, but as I progressed, it started happening in situations where I was not seeing it before. It's behavior is changing constantly, it seems.

I have only the RF_AM_FM lib loaded.

Now, in my case, it looks like it is happening even without any filtering, whatsoever.
I open the "Choose Symbol" dialog, mouse click on the group/lib name (the one with the pointing down triangle, to indicate the group is expanded) and to this component "ZETA-433-SO" and... voila, it hangs.
It's not happening with another component. Is it, because "ZETA" is the last component in a lib?

I have been trying so many things and combinations now that I don't know if this is really the only combination I saw, but it is the one that works for now.

If you want me to do more specific tests or need more information about my system, let me know. I will try my best.

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

@reece Are you using CCACHE for your builds?

Revision history for this message
Reece Pollack (reece-pollack) wrote : Re: [Bug 1767848] Re: Hang when searching symbol libraries for "fl"

No, I don't use CCACHE.

It's been a while since I did a clean build:

$ git clean -fdxq
$ git log --oneline -n4
4cac861 RRP: pcbnew: Display/enter coordinates relative to the Aux origin
e30d799 RRP: pcbnew: Change coordinate display origin to the
manufacturing origin
2b756b5 RRP: pcbnew: Display coordinates relative to user-defined origin
2cb65f9 Make the Simulator error strings translatable
$ mkdir build/debug
$ cd build/debug
$ cmake ../..
$ make -j7
$ sudo make install

  I get the same behavior.

Application: kicad
Version: (5.0.0-rc2-39-g4cac861), release build
Libraries:
     wxWidgets 3.0.2
     libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.11 libidn/1.32 librtmp/2.3
Platform: Linux 4.13.0-41-generic 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.58.0
     OpenCASCADE Community Edition: 6.8.0
     Curl: 7.47.0
     Compiler: GCC 5.4.0 with C++ ABI 1009

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

On 05/29/18 11:45, Seth Hillbrand wrote:
> @reece Are you using CCACHE for your builds?
>

Revision history for this message
Reece Pollack (reece-pollack) wrote :

Sorry it's taken so long to try your scenario.

It does NOT happen with only the Sensor_Optical library enabled, but
DOES happen if you enable my library of parts (named "MyParts") with the
Sensor_Optical library. I've attached both libraries. Let me know if
this allows you to recreate the hang.

On 04/30/18 04:39, Maciej Suminski wrote:
> Reece,
>
> I cannot reproduce the freeze with c8a78405. Can you check if other
> libraries play a role here? Does eeschema freeze when there is only
> Sensor_Lib in sym-lib-table? Could your private changes might be related
> to the problem?
>
> ** Changed in: kicad
> Milestone: None => 5.0.0-rc2
>

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I appreciate your help, but unfortunately I still fail to replicate the problem. I have tested your library set on Arch Linux, Ubuntu 16.04 and Linux Mint 18.2, two different machines and everything works as expected so far.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I have noticed that typing the magical strings (e.g. "fl") triggers some gtk asserts. I tracked them down to a particular function call that I have disabled in the attached patch. Could you apply it and see if it helps?

Changed in kicad:
importance: Undecided → Critical
Revision history for this message
Reece Pollack (reece-pollack) wrote :

@orsommmz : Sorry, your change had no effect.

The hang appears to have something to do with the dimensions of the symbol preview window in the Choose Symbol dialog. If I resize the dialog so there is more room in the symbol preview window and then click on the Flir_LEPTON symbol in the list, there is no hang. If I close KiCad and restart it, so the dialog returns to its default size, the hang occurs when I click on that symbol.

GNU DDD 3.3.12 (x86_64-pc-linux-gnu), by Dorothea LReading symbols from kicad...done.
(gdb) run
Starting program: /usr/local/bin/kicad
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
14:50:16: Debug: Checking template path '/usr/local/share/kicad/template' exists
[New Thread 0x7fffe6d9b700 (LWP 25544)]
[New Thread 0x7fffe659a700 (LWP 25545)]
[New Thread 0x7fffe5d99700 (LWP 25546)]
14:50:16: Debug: FileWatcherReset: add '/home/reece/MyProjects/MCS-4/Recreation/P170-DH/pcb/P170-DH Replacement/gerbers'

14:50:16: Debug: FileWatcherReset: watched paths:
14:50:16: Debug: /home/reece/MyProjects/MCS-4/Recreation/P170-DH/pcb/P170-DH Replacement/gerbers/

14:50:16: Debug: /home/reece/MyProjects/MCS-4/Recreation/P170-DH/pcb/P170-DH Replacement/

14:50:19: Debug: Unrecognized accel key 'bksp', accel string ignored.
LoadAllLibraries: lib_names:
 P170-DH Replacement-cache
ShowQuasiModal: optimal parent: 14SCH_EDIT_FRAME
[Thread 0x7fffe5d99700 (LWP 25546) exited]

Built from sources derived from the following Git commit:
    bfa8903 Gerbview, GAL mode: fix "Zoom to fit" area size calculation when nothing is loaded.

Application: kicad
Version: (5.0.0-rc2-63-g665671a), debug build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.11 libidn/1.32 librtmp/2.3
Platform: Linux 4.13.0-41-generic 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.58.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.47.0
    Compiler: GCC 5.4.0 with C++ ABI 1009

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

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Could you test one more patch? Also, can you check if the component browser in the Symbol Library Editor freezes the same way?

If the patch does not help, would you consider performing a git bisect to determine when the problem appeared?

Revision history for this message
Reece Pollack (reece-pollack) wrote :

It still freezes with this patch. My code base does NOT include your previous test patch, if that makes a difference.

From what old commit should I start the bisect?

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

The two patches were not related, so I think it is fine to test each individually.

It is hard to come up with a starting point for me, as I have never experienced the freeze. When I have no clue regarding the starting commit, then I pick a one month old commit and try. Git bisect will let you move the starting point earlier in the history in case you picked a commit which is still bad.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

One more trial, I have found some correlated information on the wxWidgets bug tracker [1], so perhaps the attached patch may help. It will surely be faster to check the patch then to go through a bisect process.

1. http://trac.wxwidgets.org/ticket/18141

Revision history for this message
Reece Pollack (reece-pollack) wrote :

With this last patch applied I don't see the hang. Is that because it actually fixes the problem, or just changes the magic window size that triggers the problem by changing what's displayed?

Application: eeschema
Version: (5.0.0-rc2-67-gd3c41dd-dirty), debug build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.11 libidn/1.32 librtmp/2.3
Platform: Linux 4.13.0-41-generic 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.58.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.47.0
    Compiler: GCC 5.4.0 with C++ ABI 1009

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

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 51c7381fd54871c73ee0f52a97c09382fd5771ab
https://git.launchpad.net/kicad/patch/?id=51c7381fd54871c73ee0f52a97c09382fd5771ab

Changed in kicad:
status: Incomplete → Fix Committed
assignee: nobody → Maciej Suminski (orsonmmz)
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Yay, thank you for the comforting news!

I cannot say it is a full-fledged fix, but rather a workaround for a bug in wxWidgets code. As far as I can tell, the issue has been fixed a few days ago in the wxWidgets master branch, but it will take some time to propagate it to Linux distributions.

It is not about a certain window size causing problems, but an endless loop occurring when scrollbars appear as a result of longer contents to be displayed. This is also why you have not observed the freeze when the dialog was large enough to display symbol details without showing scrollbars. You will find a more detailed explanation in the wxWidgets bug report.

Revision history for this message
Jeff Young (jeyjey) wrote :

Well done, Orson! That was a long, hard slog.

Revision history for this message
nanogordo (spencer-r-alexander) wrote :

I can also verify that the patch in comment#28 fixed my issue. Thanks for your energy in tracking this down!

Revision history for this message
nanogordo (spencer-r-alexander) wrote :

(For those following along on this bug, make sure to also patch in the following change: https://git.launchpad.net/kicad/patch/?id=64e98c8e54f087e45802b664728fb2f940)

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.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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