public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Milian Wolff <mail@milianw.de>
Cc: Aaron Merey <amerey@redhat.com>, elfutils-devel@sourceware.org
Subject: Re: caching failed lookups of debuginfo?
Date: Sat, 9 Apr 2022 00:40:27 +0200	[thread overview]
Message-ID: <YlC52zpC0G+kSYy7@wildebeest.org> (raw)
In-Reply-To: <274959185.zvkkRjgryB@milian-workstation>

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


  reply	other threads:[~2022-04-08 22:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08 19:58 Milian Wolff
2022-04-08 20:05 ` Frank Ch. Eigler
2022-04-08 20:45   ` Milian Wolff
2022-04-08 20:59     ` Mark Wielaard
2022-04-08 21:08       ` Milian Wolff
2022-04-08 21:34         ` Aaron Merey
2022-04-08 21:56           ` Milian Wolff
2022-04-08 22:21             ` Mark Wielaard
2022-04-08 22:23             ` Milian Wolff
2022-04-08 22:40               ` Mark Wielaard [this message]
2022-04-08 22:54                 ` Aaron Merey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YlC52zpC0G+kSYy7@wildebeest.org \
    --to=mark@klomp.org \
    --cc=amerey@redhat.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mail@milianw.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).