SRombauts / UEGitPlugin

Unreal Engine 5 Git LFS 2 Source Control Plugin (beta)
http://srombauts.github.io/UEGitPlugin
MIT License
806 stars 165 forks source link

Checkout and Submit both crash UE 4.25.3 #147

Open CGeorges opened 3 years ago

CGeorges commented 3 years ago

I use UE4GitPlugin and Gitea in a new Top down project, whenever I click "Checkout" or Submit it will crash UE4 with error "Out of video memory...", it seems in a second it fills up 8GB of video memory.

CGeorges commented 3 years ago

image

CGeorges commented 3 years ago

I can see this in the logs on crash

[2020.08.11-23.02.41:794][627]LogSourceControl: RunCommand: 'git lfs unlock "Content/Animations/ThirdPerson_AnimBP.uasset"'
[2020.08.11-23.02.42:983][627]LogSourceControl: RunCommand: 'git lfs locks'
[2020.08.11-23.02.43:238][627]LogD3D12RHI: Error: CommandList->Close() failed 
 at D:/Build/++UE4+Licensee/Sync/Engine/Source/Runtime/D3D12RHI/Private/D3D12CommandList.cpp:134 
 with error E_OUTOFMEMORY

Full log started from a clean file, boot up UE4 project and checkout 1 file, then crash: PartyTowers.log

CGeorges commented 3 years ago

Ran UE4 through VS and it seems when doing a checkout theres definitely a memory leak image

It's something here in GitSourceControlUtils.cpp but not sure as to what

if (!BranchName.IsEmpty())
        {
            // Using git diff, we can obtain a list of files that were modified between our current origin and HEAD. Assumes that fetch has been run to get accurate info.
            // TODO: should do a fetch (at least periodically).
            TArray<FString> Results;
            TArray<FString> ErrorMessages;
            TArray<FString> ParametersLsRemote;
            ParametersLsRemote.Add(TEXT("origin"));
            ParametersLsRemote.Add(BranchName);
            const bool bResultLsRemote = RunCommand(TEXT("ls-remote"), InPathToGitBinary, InRepositoryRoot, ParametersLsRemote, OnePath, Results, ErrorMessages);
            // If the command is successful and there is only 1 line on the output the branch exists on remote
            const bool bDiffAgainstRemote = bResultLsRemote && Results.Num();

            Results.Reset();
            ErrorMessages.Reset();
            TArray<FString> ParametersLog;
            ParametersLog.Add(TEXT("--pretty=")); // this omits the commit lines, just gets us files
            ParametersLog.Add(TEXT("--name-only"));
            ParametersLog.Add(bDiffAgainstRemote ? TEXT("HEAD..HEAD@{upstream}") : BranchName);
            const bool bResultDiff = RunCommand(TEXT("log"), InPathToGitBinary, InRepositoryRoot, ParametersLog, OnePath, Results, ErrorMessages);
            OutErrorMessages.Append(ErrorMessages);
            if (bResultDiff)
            {
                for (const FString& NewerFileName : Results)
                {
                    const FString NewerFilePath = FPaths::ConvertRelativePathToFull(InRepositoryRoot, NewerFileName);

                    // Find existing corresponding file state to update it (not found would mean new file or not in the current path)
                    if (FGitSourceControlState* FileStatePtr = OutStates.FindByPredicate([NewerFilePath](FGitSourceControlState& FileState) { return FileState.LocalFilename == NewerFilePath; }))
                    {
                        FileStatePtr->bNewerVersionOnServer = true;
                    }
                }
            }
        }
CGeorges commented 3 years ago

I've used this fork https://github.com/ProjectBorealis/UE4GitPlugin and shared video memory no longer gets filled.

Acren commented 3 years ago

I'm getting this in 2.17, 4.26, even without running any commands. Just importing some assets and having it automatically check the status is enough to have it run out of video memory.

christopher-buss commented 3 years ago

This is happening to one of my colleges, 4.26. Almost definitely a memory leak. Just trying to check back in a file causes his ram usage to spike up before Unreal crashes.

CGeorges commented 3 years ago

This is happening to one of my colleges, 4.26. Almost definitely a memory leak. Just trying to check back in a file causes his ram usage to spike up before Unreal crashes.

I haven't really found a solution for this back then, I even bought the commercial solution of this plugin on UE4 marketplace and that one was crashing as well. We switched to Perforce and never looked back.

SRombauts commented 1 year ago

see https://github.com/SRombauts/UE4GitPlugin/issues/139 that will track the fix