From: Frank Ch. Eigler Date: Tue, 20 Oct 2020 23:26:04 +0000 (-0400) Subject: debuginfod: suppress fdcache prefetching during dwz lookup X-Git-Tag: elfutils-0.182~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e402d84c596705261d272bb047e94e824245411e;p=thirdparty%2Felfutils.git 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 --- diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 8cb89967e..688404e5d 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2020-10-20 Frank Ch. Eigler + + * debuginfod.cxx (handle_buildid*): Add a parameter for detecting + internally-originated lookups for dwz resolution. + 2020-09-18 Frank Ch. Eigler * debuginfod.cxx (scan_source_file, archive_classify): Store only diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 140b7789d..7907fecc7 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; }