Disable tcmalloc with Clang Thread Sanitizer.
Fix possible data races.
Fix bug with rewriting manifest for direct cache entry.

The problem appears when the number of headers was changed. The manifest
file was opened without O_TRUNC, leaving parts of previous strings at
the end.
Add more logs to diagnose the problem when we can't get Clang version.