[ccache] Why not cache compile failures?

Shentino shentino at gmail.com
Sat Sep 29 04:07:52 MDT 2012


On Mon, Sep 24, 2012 at 1:44 AM, Andrew Stubbs <ams at codesourcery.com> wrote:
> On 22/09/12 13:13, Joel Rosdahl wrote:
>>
>> On 18 September 2012 14:16, Andrew Stubbs <ams at codesourcery.com> wrote:
>>>
>>> I'm aware that there's some danger here that we can end up caching Ctrl-C
>>> interrupts, SIGTERM/SIGKILL terminations, out-of-memory failures, and all
>>> manner of other non-reproducible failures, but these are the unusual
>>> case,
>>> and nothing that can't be fixed with CCACHE_RECACHE.
>>
>>
>> I would be OK with caching failures if it's off by default and doesn't
>> affect the default's performance. Have you thought about how to store
>> the exit code in the cache?
>
>
> The simplest way would be a tiny file in the cache that just contained the
> code. Say with extension ".error".
>
> I'd prefer it to be on by default, if only to prevent other devs breaking
> it, but that's your decision to make, of course.
>
>
>>> I might suggest emitting an extra warning message that informs the user
>>> that
>>> they are seeing a cached failure.
>>
>>
>> Printing an extra warning message would break ccache's transparency,
>> but perhaps that would be acceptable for failures. Have to think more
>> about it.
>
>
> It would definitely break the compiler testsuite, but if you're testing that
> through ccache you have bigger problems.
>
> Otherwise, I don't know of any cases where scripts check error/warning
> messages beyond whether they exist or not. Since I would have it only emit
> the "warning" when there are already "error" messages, it would only break
> in unusual cases.
>
> Thanks for your feedback, I'll have a bash at it soonish.
>
> Andrew
>
> _______________________________________________
> ccache mailing list
> ccache at lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache

I'd have to agree that caching failures is tricky.

Transient errors are temporary by definition and shouldn't be cached.

What if compile failures were only cached for a limited amount of
time, say, an hour or so?

Assuming that cache entries are timestamped to allow for LRU purges if
the cache overflows, implementing a TTL mechanism to flush transient
failures out of the cache might be an easy enhancement.


More information about the ccache mailing list