Eeschema/Pcbnew leaks filedescriptors

Bug #1788227 reported by slowcoder
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Critical
Jeff Young

Bug Description

Every now and then (don't you love that), either Eeschema or Pcbnew leaks a massive amount of filedescriptors, leading to it using up all available descriptors, and failing to save ones work. Previous save seems to be intact in .bak files, although that has failed once for me.

In typical use, the Kicad processes uses 148 descriptors for me. Seems unchanged no matter what I do.
However, every now and then, it shoots up to 1025 (ulimit on my system), and it fails to save files.

Unfortunately, I haven't been able to track down exactly what causes it. However, as it just happened, this is roughly what I did:
1. Create new 625 pin footprint (simple array)
2. Start creating the schematic symbol for the component.
3. While creating the component, created a dummy schematic to just connect the pins together, so I could get an idea of the floorplanning of the BGA (i.e, connect together all GND pins, all 3.3V pins, etc).
4. About 200 pins into this process, it failed.
(Of course, I save the footprint and "F8" from Eeschema quite often during this process)

KiCad version: 6fdc5972f8431b4d5831a32649e67bfe20d05de8 (I.e, post 5.0)
OS: Linux 4.17.2

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

I suspect this is what @Hildo was seeing too.

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

When this happens, can you open a terminal window and show us the output of

lsof|grep -E "^kicad"

Revision history for this message
slowcoder (slowcoder) wrote :

Looking into it more closely, it seems like it leaks slowly.

Working since the I submitted the bugreport, it has leaked 356 fds.

user@computer ~ $ ps auxww | grep kicad
user 27963 13.2 0.9 1241820 304692 ? Ssl 17:49 0:12 kicad
user@computer ~ $ ls -l /proc/27963/fd/ | wc -l
26 <-- When I just started KiCad
user@computer ~ $ ls -l /proc/27963/fd/ | wc -l
382 <-- Now

Attached is the lsof output

Revision history for this message
slowcoder (slowcoder) wrote :

Ah, I've found out how to reproduce it easily (at least here).

Open and close the footprint editor. No need to do anything in it. Leaks 100+ fds

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

@slowcoder, could you let me know if the attached patch fixes it for you? Thanks!

Changed in kicad:
assignee: nobody → Jeff Young (jeyjey)
status: New → In Progress
Jeff Young (jeyjey)
Changed in kicad:
importance: Undecided → Critical
Revision history for this message
slowcoder (slowcoder) wrote :

@jeyjey It seems like it does. Testing a few minutes, and it stays rock-solid at 26 fds.

Thanks a bunch!

Changed in kicad:
milestone: none → 5.1.0
Revision history for this message
Jeff Young (jeyjey) wrote :

Cool. Thanks for testing.

Jeff Young (jeyjey)
Changed in kicad:
status: In Progress → 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.