This is a well known (long standing) issue. Documented in the code base in commit eea02be70ee37b845f2719b3c08e5baf4b6f51f6.

Countless intermittent sanitizer warnings can be attributed to it.
{
    
    
    
    if (!LockDataDirectory(false)) {
        
        return false;
    }
    return true;
}
bool AppInitMain(NodeContext& node)
{
    const CChainParams& chainparams = Params();
    
    if (!CreatePidFile()) {
        
        return false;
    }
    if (LogInstance().m_print_to_file) {
        if (gArgs.GetBoolArg("-shrinkdebugfile", LogInstance().DefaultShrinkDebugFile())) {
            
            
            LogInstance().ShrinkDebugFile();
        }
    }
    if (!LogInstance().StartLogging()) {