UnrealGameSync sync failure after enabling USDImporter plugin

Greetings! Recently we have enabled USDImporter plugin in our project and it lead to sync issues in UGS for people using precompiled binaries.

Sync fails with an exception:

System.UnauthorizedAccessException: Access to the path 'D:\Work\Engine\Binaries\ThirdParty\USD\UsdResources\Win64\plugins\plugInfo.json' is denied. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Compression.ZipFileExtensions.ExtractToFile(ZipArchiveEntry source, String destinationFileName, Boolean overwrite) at UnrealGameSync.ArchiveUtils.ExtractFiles(FileReference archiveFileName, DirectoryReference baseDirectoryName, FileReference manifestFileName, ProgressValue progress, ILogger logger) in E:\AgentUE\Engine\Source\Programs\UnrealGameSync\UnrealGameSyncShared\ArchiveManifest.cs:line 118 at UnrealGameSync.PerforceArchiveChannel.PerforceArchive.DownloadAsync(IPerforceConnection perforce, DirectoryReference localRootPath, FileReference manifestFileName, ILogger logger, ProgressValue progress, CancellationToken cancellationToken) in E:\AgentUE\Engine\Source\Programs\UnrealGameSync\UnrealGameSyncShared\ArchiveInfo.cs:line 135 at UnrealGameSync.WorkspaceUpdate.ExecuteAsync(IPerforceSettings perforceSettings, ProjectInfo project, WorkspaceStateWrapper stateMgr, ILogger logger, CancellationToken cancellationToken) in E:\AgentUE\Engine\Source\Programs\UnrealGameSync\UnrealGameSyncShared\WorkspaceUpdate.cs:line 1190 at UnrealGameSync.Workspace.UpdateWorkspaceMini(WorkspaceUpdate update, Task prevUpdateTask, CancellationToken cancellationToken) in E:\AgentUE\Engine\Source\Programs\UnrealGameSync\UnrealGameSync\Workspace.cs:line 174Those who rely on local project compilation do not face any issues syncing.

Please advise on how to fix this exception or suggest how to collect additional data that may help debug this issue.

Thanks in advance!

Hi Gregory,

Is the path ‘D:\Work\Engine\Binaries\ThirdParty\USD\UsdResources\Win64\plugins\plugInfo.json’ where you’re deploying the precombiled binaries?

Is that file previously installed or already existing at that location and locked somehow?

Can you try deleting that file manually and sync again?

I don’t see why enabling the USDImporter plugin would cause an issue with UGS and the only thing I can think of is that file being locked by some process.

Very strange that it happened with a new workspace.

Have you tried rebooting the computer where this happens then sync with UGS?

If it still happens after the reboot, could you try deleting D:\Work\Engine\Binaries\ThirdParty\USD and sync with UGS again?

Thanks for confirming this workaround works. I’ve informed the UGS developers of this issue. Internally, this is a rare issue and has occurred only twice in the past year. Usually when this exception happens it’s because the file is currently used and locked (like an .exe or .dll) so the recommendation is to reboot.

We are aware of two reasons that could cause an exception:

1) The file is currently in use and locked, thus the usual recommendation to reboot.

2) The file is read-only. This is solved by deleting it.

In the second case, it could be of interest to know how the file ends up in that state, but in the end the file has to be either deleted or have its read-only attribute removed.

For future reference:

It turns out we had many files from the Engine\Binaries\ThirdParty\USD\ directory in the depot, and their sizes differed from those in the precompiled binaries. As a result, during syncing via UGS, they failed to delete and remained read-only, which led to a crash.

The crucial detail I was missing was the log entries: “Skipping X due to modified length.”

After deleting the USD folder from the depot, everything started syncing correctly.

Thanks for reporting your findings!

I’ve reproduced the issue on a fresh depot that is using precompiled binaries. So this file was abscent before I started syncing.

This path relates to that depot on my PC, with root at D:\Work

The only new thing I noticed is that everything works fine after you build engine locally. Switching back to precompiled binaries and syncing doesn’t lead to that exception anymore. Unforntunately that’s not a real solution.

Rebooting didn’t help, but re-syncing after deleting the specified folder did. I wonder if this points to a potential fix, since it’s a rather inconvenient operation for everyone using precompiled binaries — and for future UGS users as well.

But rebooting doesn’t help in our case. Deleting the folder does. Maybe there’s anything I can do to get more debug information that may help pinpoint the exception?