The proposed solution here is to make the casing of the path provided to the hashing function for the mutex consistent with something like:

public static string GetUniqueMutexForPath(string Name, string UniquePath)
    return String.Format("Global\\{0}_{1}", Name, UniquePath.ToLower().GetHashCode());

By adding ToLower to UniquePath.


Steps to Reproduce

Run something similar to this from a batch file:

start cmd.exe /k D:\ue4\Engine\Binaries\DotNet\UnrealBuildTool.exe ShaderCompileWorker Win64 Development -NoHotReloadFromIDE -WaitMutex -progress

start cmd.exe /k d:\ue4\Engine\Binaries\DotNet\UnrealBuildTool.exe ShaderCompileWorker Win64 Development -NoHotReloadFromIDE -WaitMutex -progress

Note how the case of the drive letter is different. *D:* and *d:*. Any case-sensitive difference of the path will cause this problem, but the correctness of the drive letter can be the most undefined. One of the builds will probably fail with:

ERROR: Unhandled exception: System.Exception: Unable to open log file for writing (D:\ue4\Engine\Programs\UnrealBuildTool\Log.txt) ---> System.IO.IOException: The process cannot access the file 'D:\ue4\Engine\Programs\UnrealBuildTool\Log.txt' because it is being used by another process.     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)


Have Comments or More Details?

There's no existing public thread on this issue, so head over to AnswerHub just mention UE-105027 in the post.

Login to Vote

ComponentDevTools - UnrealBuildTool
Affects Versions4.26
Target Fix4.26.1
Fix Commit14999955
Release Commit14999955
CreatedJan 5, 2021
ResolvedJan 6, 2021
UpdatedApr 27, 2021