Skip to content

Commit 165361b

Browse files
committed
Merged PR 744061: Log directory content when we fail to update the file content table
This adds more logging info for the case where we hit a file not found error and the cache believes the file exists.
1 parent 018b2c6 commit 165361b

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

Public/Src/Engine/Scheduler/Scheduler.cs

+22-2
Original file line numberDiff line numberDiff line change
@@ -7229,9 +7229,29 @@ Possible<Unit> IFileContentManagerHost.ReportFileArtifactPlaced(in FileArtifact
72297229
flags,
72307230
(handle, length) => m_fileContentTable.RecordContentHash(handle, pathAsString, fileMaterializationInfo.FileContentInfo.Hash, fileMaterializationInfo.FileContentInfo.Length));
72317231
}
7232-
catch (BuildXLException e)
7232+
catch (Exception e)
72337233
{
7234-
return new NativeFailure(e.GetLogEventErrorCode()).Annotate($"An error occurred updating the file content table for modified file '{pathAsString}'. Details: {e.Message}");
7234+
// We sporadically get a file not found error when trying to open a handle to the path (on Linux, with the ephemeral cache on). Let's list the content of the directory to try to spot what's going on. One theory
7235+
// is that the cache has some sort of casing issue. This is a best-effort attempt to get more information about the issue. We can remove the enumeration once we understand the problem.
7236+
IEnumerable<string> containingEntries = CollectionUtilities.EmptyArray<string>();
7237+
7238+
try
7239+
{
7240+
var directory = Directory.GetParent(pathAsString);
7241+
if (directory != null)
7242+
{
7243+
containingEntries = Directory.EnumerateFileSystemEntries(directory.FullName);
7244+
}
7245+
}
7246+
#pragma warning disable ERP022 // Unobserved exception in generic exception handler
7247+
catch
7248+
{
7249+
// Ignore any exceptions that may occur while enumerating the directory, this is done on a best-effort basis for debugging purposes.
7250+
}
7251+
#pragma warning restore ERP022 // Unobserved exception in generic exception handler
7252+
7253+
return new NativeFailure(e.GetLogEventErrorCode()).Annotate($"An error occurred updating the file content table for modified file '{pathAsString}'. " +
7254+
$"Content of the directory is: [{string.Join(",", containingEntries)}]. Details: {e}");
72357255
}
72367256
}
72377257

0 commit comments

Comments
 (0)