Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Apr 2023 19:41:47 -0700
From:      Bakul Shah <bakul@iitbombay.org>
To:        Craig Leres <leres@freebsd.org>
Cc:        freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: ccache
Message-ID:  <D912C2AE-0373-4ABA-BFBE-CC54FF28E152@iitbombay.org>
In-Reply-To: <92bc05d9-14fc-0928-4f36-4b55815303fe@freebsd.org>
References:  <671864AD-11F0-487B-9597-ACF28D24591B@iitbombay.org> <92bc05d9-14fc-0928-4f36-4b55815303fe@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help



> On Apr 3, 2023, at 6:48 PM, Craig Leres <leres@freebsd.org> wrote:
> 
> On 4/3/23 17:09, Bakul Shah wrote:
>> Am I use ccache incorrectly or is there a bug?
>> # CCACHE_DIR=/usr/obj/ccache ccache -s
>> cache directory                     /usr/obj/ccache
>> primary config                      /usr/obj/ccache/ccache.conf
>> secondary config      (readonly)    /usr/local/etc/ccache.conf
>> stats updated                       Mon Apr  3 16:54:31 2023
>> ...
>> cleanups performed                   507
>> files in cache                   2795230
>> cache size                           2.9 GB <===
>> max cache size                      15.0 GB
>> # find /usr/obj/ccache -type f |wc
>>  2795395 2795395 142222206
>> # du -sh /usr/obj/ccache
>>  83G    /usr/obj/ccache <===
>> I have
>> WITH_CCACHE_BUILD=yes
>> CCACHE_DIR=/usr/obj/ccache
>> in /etc/make.conf
> 
> Thank you for bringing this up; I have the same issue and have never figured it out. But I think I've found another piece or two of the puzzle.
> 
> Using my favorite ktrace trick we can see that by default it tries to open /usr/local/etc/ccache.conf:
> 
>    zinc 32 % cd /tmp && ktrace -di ccache -s > /dev/null
>    zinc 33 % kdump | fgrep NAMI | fgrep ccache.conf
>     17418 ccache   NAMI  "/usr/local/etc/ccache.conf"
>  17418 ccache   NAMI  "/home/zinc/u0/leres/.ccache/ccache.conf"
> 
> I suspect the trick here is when ccache runs inside a poudriere jail, ccache.conf is not present and/or not in the right location.

I checked that it uses the correct ccache.conf and ccache dir.

> 
> On my build server I have /var/cache/ccache/ccache.conf which I believe works for some things but I still have 46 GB in /var/cache/ccache and /var/cache/ccache/ccache.conf is trying to limit use to 8 GB.
> 
> If I start up a poudriere jail and look around I find /root/.ccache/ccache.conf is a copy of /var/cache/ccache/ccache.conf. So I don't get why it doesn't work.
> 
> (Now I'll sit back and wait for something who knows more chimes in...)
> 
> Craig

I did the same thing this time as before -- I manually ran
"ccache -c".

Even now the number it reports is smaller by a few G than
what du -sh reveals, and it says there are many more files
in the cache than find reveals.

I suspect it either doesn't do proper bookkeeping or gets
confused if you ^Ced a build at the wrong time. It does
seem to update $CCACHE_DIR/?/stats files.

ccache -c took a very long time. ktrace shows it does
the equivalent of 
for each file f to be deleted
  rename $f $f.ccache.rm.tmp
  unlink $f.ccache.rm.tmp

Not sure why the rename is needed.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D912C2AE-0373-4ABA-BFBE-CC54FF28E152>