summaryrefslogtreecommitdiff
path: root/debuginfod
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2020-10-20 19:26:04 -0400
committerFrank Ch. Eigler <fche@redhat.com>2020-10-21 10:06:51 -0400
commite402d84c596705261d272bb047e94e824245411e (patch)
tree26f47dc7c53738acd9fe27d11a556cb124d336ab /debuginfod
parentfee123fb771f46274dfc8260c00f5d3061de2cd2 (diff)
downloadelfutils-e402d84c596705261d272bb047e94e824245411e.tar.gz
debuginfod: suppress fdcache prefetching during dwz lookup
During a recent from-scratch reindexing of the rpm/deb corpus at debuginfod.elfutils.org, we found the fdcache chewed up an abnormal amount of $TMPDIR space. This was due to internal .dwz lookups, which triggered fdcache prefetching as for a webapi query, but there was not a timely fdcache eviction pass to clean it up again. Rather than add that pass, it's better to suppress the prefetching completely, as an internal .dwz search will only ever need that file, not any others from the same archive. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
Diffstat (limited to 'debuginfod')
-rw-r--r--debuginfod/ChangeLog5
-rw-r--r--debuginfod/debuginfod.cxx20
2 files changed, 18 insertions, 7 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 8cb89967..688404e5 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2020-10-20 Frank Ch. Eigler <fche@redhat.com>
+
+ * debuginfod.cxx (handle_buildid*): Add a parameter for detecting
+ internally-originated lookups for dwz resolution.
+
2020-09-18 Frank Ch. Eigler <fche@redhat.com>
* debuginfod.cxx (scan_source_file, archive_classify): Store only
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 140b7789..7907fecc 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -890,10 +890,12 @@ add_mhd_last_modified (struct MHD_Response *resp, time_t mtime)
static struct MHD_Response*
-handle_buildid_f_match (int64_t b_mtime,
+handle_buildid_f_match (bool internal_req_t,
+ int64_t b_mtime,
const string& b_source0,
int *result_fd)
{
+ (void) internal_req_t; // ignored
int fd = open(b_source0.c_str(), O_RDONLY);
if (fd < 0)
{
@@ -1226,7 +1228,8 @@ string canonicalized_archive_entry_pathname(struct archive_entry *e)
static struct MHD_Response*
-handle_buildid_r_match (int64_t b_mtime,
+handle_buildid_r_match (bool internal_req_p,
+ int64_t b_mtime,
const string& b_source0,
const string& b_source1,
int *result_fd)
@@ -1330,7 +1333,8 @@ handle_buildid_r_match (int64_t b_mtime,
// 3) extract some number of prefetched entries (just into fdcache)
// 4) abort any further processing
struct MHD_Response* r = 0; // will set in stage 2
- unsigned prefetch_count = fdcache_prefetch; // will decrement in stage 3
+ unsigned prefetch_count =
+ internal_req_p ? 0 : fdcache_prefetch; // will decrement in stage 3
while(r == 0 || prefetch_count > 0) // stage 1, 2, or 3
{
@@ -1424,16 +1428,17 @@ handle_buildid_r_match (int64_t b_mtime,
static struct MHD_Response*
-handle_buildid_match (int64_t b_mtime,
+handle_buildid_match (bool internal_req_p,
+ int64_t b_mtime,
const string& b_stype,
const string& b_source0,
const string& b_source1,
int *result_fd)
{
if (b_stype == "F")
- return handle_buildid_f_match(b_mtime, b_source0, result_fd);
+ return handle_buildid_f_match(internal_req_p, b_mtime, b_source0, result_fd);
else if (b_stype == "R")
- return handle_buildid_r_match(b_mtime, b_source0, b_source1, result_fd);
+ return handle_buildid_r_match(internal_req_p, b_mtime, b_source0, b_source1, result_fd);
else
return 0;
}
@@ -1531,7 +1536,8 @@ handle_buildid (MHD_Connection* conn,
// Try accessing the located match.
// XXX: in case of multiple matches, attempt them in parallel?
- auto r = handle_buildid_match (b_mtime, b_stype, b_source0, b_source1, result_fd);
+ auto r = handle_buildid_match (conn ? false : true,
+ b_mtime, b_stype, b_source0, b_source1, result_fd);
if (r)
return r;
}