This is an archive of the discontinued LLVM Phabricator instance.

Disable LLDB index cache for .o files with no UUID.
ClosedPublic

Authored by clayborg on Mar 3 2022, 4:59 PM.

Details

Summary

After enabling the LLDB index cache in production we discovered that some distributed build systems play with the modification times of any .o files that were downloaded from the build cache. This was causing the LLDB index cache to read the wrong cache file for files that didn't have a UUID as all of the modfication times were set to the same value by the build system. When new .o files were downloaded, the only unique identifier was the mod time which were all the same, and we would load an older cache for the updated .o file. So disabling caching of files that have no UUIDs for now until we can create a more solid solution.

Diff Detail

Event Timeline

clayborg created this revision.Mar 3 2022, 4:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2022, 4:59 PM
Herald added a subscriber: arphaman. · View Herald Transcript
clayborg requested review of this revision.Mar 3 2022, 4:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2022, 4:59 PM
yinghuitan accepted this revision.Mar 3 2022, 10:01 PM
yinghuitan added inline comments.
lldb/include/lldb/Core/DataFileCache.h
128

Do we plan to ship with this design (no caching for module .o file without uuid)? If so, I wonder if we should emit reason information for module not loaded from cache (like signature mismatch/changed vs uuid unavailable)?

This revision is now accepted and ready to land.Mar 3 2022, 10:01 PM
yinghuitan added inline comments.Mar 3 2022, 10:02 PM
lldb/include/lldb/Core/DataFileCache.h
128

I mean emit not-load-from-cache reason in "statistics dump".

clayborg updated this revision to Diff 413115.Mar 4 2022, 12:59 PM

Added unit tests for CacheSignature that covers:

  • making sure encoding fails when we have an invalid CacheSignature
  • make sure decoding of older cache files that had a previously valid signature fails when there is no UUID
  • fix a bug in the CacheSignature encoding of object modification times
yinghuitan added inline comments.Mar 4 2022, 1:17 PM
lldb/include/lldb/Core/DataFileCache.h
130–137

Nit: I believe this can be simplified as:

return m_uuid == rhs.m_uuid && m_mod_time == rhs.m_mod_time && m_obj_mod_time == rhs.m_obj_mod_time;
clayborg updated this revision to Diff 416334.Mar 17 2022, 2:51 PM

Address operator == inline suggestion for CacheSignature

clayborg marked an inline comment as done.Mar 17 2022, 2:52 PM
yinghuitan accepted this revision.Mar 31 2022, 2:31 PM
This revision was automatically updated to reflect the committed changes.