public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug debuginfod/29117] New: debuginfod client leaking fd's for cache misses
@ 2022-05-03 23:45 fche at redhat dot com
  2022-05-04  1:59 ` [Bug debuginfod/29117] " fche at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fche at redhat dot com @ 2022-05-03 23:45 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29117

            Bug ID: 29117
           Summary: debuginfod client leaking fd's for cache misses
           Product: elfutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: debuginfod
          Assignee: unassigned at sourceware dot org
          Reporter: fche at redhat dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

There appears to be an fd leak in the debuginfod client cache-miss code path. 
This can exhaust fd resources over time, which is bad for a long-lived client
such as debuginfod itself.  Trying to reproduce the trigger operation sequence.
 But the end result is the client holding onto file descriptors like 

debuginfo 10215 debuginfod   81r   REG                8,0         0   927302
/var/cache/debuginfod/.debuginfod_client_cache/3b47e7f26e7ed1dda18165fb20cb56769affdd19/debuginfo
(deleted)

... while the files actually exist, despite the (deleted) tag; maybe they were
recreated later:

[root@elastic ~]# ls -ald
/var/cache/debuginfod/.debuginfod_client_cache/3b47e7f26e7ed1dda18165fb20cb56769affdd19/debuginfo
-rw-r--r-- 1 debuginfod debuginfod 0 May  3 23:40
/var/cache/debuginfod/.debuginfod_client_cache/3b47e7f26e7ed1dda18165fb20cb56769affdd19/debuginfo

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debuginfod/29117] debuginfod client leaking fd's for cache misses
  2022-05-03 23:45 [Bug debuginfod/29117] New: debuginfod client leaking fd's for cache misses fche at redhat dot com
@ 2022-05-04  1:59 ` fche at redhat dot com
  2022-05-04 11:08 ` mark at klomp dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: fche at redhat dot com @ 2022-05-04  1:59 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29117

--- Comment #1 from Frank Ch. Eigler <fche at redhat dot com> ---
Created attachment 14089
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14089&action=edit
possible patch

By inspection, in the unlink too-old negative-hit cache file case, we don't
close the fd.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debuginfod/29117] debuginfod client leaking fd's for cache misses
  2022-05-03 23:45 [Bug debuginfod/29117] New: debuginfod client leaking fd's for cache misses fche at redhat dot com
  2022-05-04  1:59 ` [Bug debuginfod/29117] " fche at redhat dot com
@ 2022-05-04 11:08 ` mark at klomp dot org
  2022-05-04 11:09 ` mark at klomp dot org
  2022-05-04 14:48 ` fche at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2022-05-04 11:08 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29117

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
Nice find.

BTW. Playing with valgrind --track-fds=yes you can find a couple of other file
descriptor leaks in debuginfod_init_cache, debuginfod_config_cache and
debuginfod-find itself.

Note that when using newer valgrind there is a bit of interference because
valgrind itself is using debuginfod-find (you can move it out of the way so
valgrind cannot find it).

These aren't as bad since they only happen on first initialization or just
before process termination.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debuginfod/29117] debuginfod client leaking fd's for cache misses
  2022-05-03 23:45 [Bug debuginfod/29117] New: debuginfod client leaking fd's for cache misses fche at redhat dot com
  2022-05-04  1:59 ` [Bug debuginfod/29117] " fche at redhat dot com
  2022-05-04 11:08 ` mark at klomp dot org
@ 2022-05-04 11:09 ` mark at klomp dot org
  2022-05-04 14:48 ` fche at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2022-05-04 11:09 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29117

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 14090
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14090&action=edit
More fd leaks

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debuginfod/29117] debuginfod client leaking fd's for cache misses
  2022-05-03 23:45 [Bug debuginfod/29117] New: debuginfod client leaking fd's for cache misses fche at redhat dot com
                   ` (2 preceding siblings ...)
  2022-05-04 11:09 ` mark at klomp dot org
@ 2022-05-04 14:48 ` fche at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: fche at redhat dot com @ 2022-05-04 14:48 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29117

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from Frank Ch. Eigler <fche at redhat dot com> ---
pushed via:
commit 59158656f3b0b99d8784ddc82c15778813000edc (HEAD -> master, origin/master,
origin/HEAD)
Author: Frank Ch. Eigler <fche@redhat.com>
Date:   Wed May 4 10:26:42 2022 -0400

    PR29117: fix fd leak in debuginfod client for cache-miss files

    Correct a nasty fd leak and a few less nasty leaks in the debuginfod
    client code.  The nasty one impacts long-lived apps such as debuginfod
    servers.

    Signed-off-by: Mark Wielaard  <mark@klomp.org>
    Signed-off-by: Frank Ch. Eigler <fche@redhat.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-04 14:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 23:45 [Bug debuginfod/29117] New: debuginfod client leaking fd's for cache misses fche at redhat dot com
2022-05-04  1:59 ` [Bug debuginfod/29117] " fche at redhat dot com
2022-05-04 11:08 ` mark at klomp dot org
2022-05-04 11:09 ` mark at klomp dot org
2022-05-04 14:48 ` fche at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).