Merged PR 794980: Log more information when bxl failed to open a file for hashing

Log sharing violation and timeout separately
Log current bxl pid when we find a bxl process holds a handle
This commit is contained in:
Qi Wang 2024-07-12 21:18:27 +00:00
Родитель 50a1c536d4
Коммит cd302cb597
4 изменённых файлов: 12 добавлений и 5 удалений

Просмотреть файл

@ -454,7 +454,7 @@ namespace BuildXL.Engine.Cache.Artifacts
if (openResult.Status == OpenFileStatus.Timeout ||
openResult.Status == OpenFileStatus.SharingViolation)
{
Tracing.Logger.Log.TimeoutOpeningFileForHashing(m_loggingContext, expandedPath);
Tracing.Logger.Log.OpeningFileFailedForHashing(m_loggingContext, expandedPath, openResult.Status.ToString());
return false; // returning "not done", i.e., do retry
}
else

Просмотреть файл

@ -69,13 +69,14 @@ namespace BuildXL.Engine.Cache.Tracing
public abstract void FailedOpenHandleToGetKnownHashDuringMaterialization(LoggingContext context, string path, string message);
[GeneratedEvent(
(int)LogEventId.TimeoutOpeningFileForHashing,
(int)LogEventId.OpeningFileFailedForHashing,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Verbose,
Keywords = (int)Keywords.UserMessage,
EventTask = (int)Tasks.Storage,
Message = "The path '{0}' could not be opened for hashing because the filesystem returned ERROR_TIMEOUT.")]
public abstract void TimeoutOpeningFileForHashing(LoggingContext context, string path);
Message = "The path '{0}' could not be opened for hashing because the filesystem returned {error}.")]
public abstract void OpeningFileFailedForHashing(LoggingContext context, string path, string error);
[GeneratedEvent(
(int)LogEventId.HashedReparsePointAsTargetPath,

Просмотреть файл

@ -29,7 +29,7 @@ namespace BuildXL.Engine.Cache.Tracing
RetryOnLoadingAndDeserializingMetadata = 746,
TimeoutOpeningFileForHashing = 748,
OpeningFileFailedForHashing = 748,
TemporalCacheEntryTrace = 2733,
}

Просмотреть файл

@ -34,6 +34,8 @@ namespace BuildXL.Native.IO.Windows
private static readonly SecurityIdentifier s_worldSid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
private static readonly int s_currentBxlPid = Process.GetCurrentProcess().Id;
/// <inheritdoc />
public PosixDeleteMode PosixDeleteMode { get; set; }
@ -2112,6 +2114,10 @@ namespace BuildXL.Native.IO.Windows
Process process = Process.GetProcessById(pid);
builder.AppendFormat("Handle was used by '{0}' with PID '{1}'.", process.ProcessName, pid);
if (process.ProcessName.Equals("bxl"))
{
builder.AppendFormat(" bxl is holding the handle. Current bxl process PID is {0}.", s_currentBxlPid);
}
builder.AppendLine();
}
catch (Exception ex)