From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 0E782385840C for ; Fri, 8 Apr 2022 22:40:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0E782385840C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x0f.wildebeest.org [172.31.17.145]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id D998130008BD; Sat, 9 Apr 2022 00:40:27 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id 8CAA42E81166; Sat, 9 Apr 2022 00:40:27 +0200 (CEST) Date: Sat, 9 Apr 2022 00:40:27 +0200 From: Mark Wielaard To: Milian Wolff Cc: Aaron Merey , elfutils-devel@sourceware.org Subject: Re: caching failed lookups of debuginfo? Message-ID: References: <4448277.fIUe8AKecr@milian-workstation> <2180828.1FMjDaRedj@milian-workstation> <274959185.zvkkRjgryB@milian-workstation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <274959185.zvkkRjgryB@milian-workstation> X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2022 22:40:30 -0000 Hi Milian, On Sat, Apr 09, 2022 at 12:23:32AM +0200, Milian Wolff wrote: > ``` > # first we stat the target cache path > if (stat(target_cache_path, &st) == 0 > { > > # then we pass _the same st_ to > debuginfod_config_cache(cache_miss_path, cache_miss_default_s, &st) > > # which internally will do > stat(config_path, st) > > # then we check the time delta > time(NULL) - st.st_mtime <= cache_miss > ``` > > I.e. when we check the time delta, we only take the time stamp of the > `config_path` into account - the time stamp of the `target_cache_path` is > ignored. O, wow. Yes, reusing the struct st is bad. > I mount my filesystems with relatime (old advise for ssd's, probably not > relevant anymore?). I guess that's the issue then? No, I think this is unrelated. > Can we change the above code to store the `st.st_mtime` for > `target_cache_path` and use that for comparison purposes? That fixes the issue > for my case. If this is acceptable, I'll provide a patch. Yes please. Thanks so much for finding this. I think we as developers keep clearing the cache to test stuff. But that means we recreate the cache_miss file every time, so that gets a new mtime. And if you are just testing for 10 minutes everything looks fine... Cheers, Mark