ProjectBorealis / UEGitPlugin

Unreal Engine Git Source Control Plugin (refactored)
MIT License
498 stars 104 forks source link

Crash during start up can't LoadModule #51

Closed paulash closed 1 year ago

paulash commented 2 years ago

Hello. Using latest release 3.06, and unreal 5.0.2 me and my coworker are getting crashing randomly in unreal during the initial loading of the plugin. When it happens it seems to happen a few times in a row then go away.

The crash is within ModuleManager.cpp, in LoadModuleCheck. When the plugin attempts to start handing the branch check.

UnrealEditor-Core.dll!FModuleManager::LoadModuleChecked(const FName InModuleName) Line 388 C++ UnrealEditor-GitSourceControl-Win64-DebugGame.dll!FGitSourceControlModule::Get() Line 118 C++ UnrealEditor-GitSourceControl-Win64-DebugGame.dll!GitSourceControlUtils::GetBranchName(const FString & InPathToGitBinary, const FString & InRepositoryRoot, FString & OutBranchName) Line 523 C++ UnrealEditor-GitSourceControl-Win64-DebugGame.dll!FGitSourceControlProvider::CheckRepositoryStatus::l2::void (void)::l2::() Line 114 C++ UnrealEditor-GitSourceControl-Win64-DebugGame.dll!FGitSourceControlProvider::CheckRepositoryStatus::l2::() Line 139 C++ UnrealEditor-GitSourceControl-Win64-DebugGame.dll!UE::Core::Private::Function::TFunctionRefCaller<void (void),void cdecl(void)>::Call(void * Obj) Line 549 C++

mastercoms commented 2 years ago

What's the actual error? Access violation?

paulash commented 2 years ago

It throws an exception when it validates on this line.

IModuleInterface& FModuleManager::LoadModuleChecked( const FName InModuleName )
{
    IModuleInterface* Module = LoadModule(InModuleName, ELoadModuleFlags::LogFailures);
    checkf(Module, TEXT("%s"), *InModuleName.ToString()); <== throw.

    return *Module;
}

seems like the modules not loading correctly, or its a race condition or something.

paulash commented 2 years ago

if I continue passed that, it dies with a read access violation as the provider is junk memory.

mastercoms commented 2 years ago

Ok, thanks, will check it out!

paulash commented 2 years ago

Any update on this, it seems to be becoming worse I have to continually hit rerun till I get in now haha.

mastercoms commented 2 years ago

I haven't been able to spot the race condition yet. As a workaround, you could add || true to this line.

linqen commented 2 years ago

I'm having the exact same issue, @paulash did that workaround solved it?

@mastercoms doing some debugging, could it be related to loading the module in another thread, OR the LoadingPhase, that is currently set to "Default"?

https://docs.unrealengine.com/5.0/en-US/API/Runtime/Projects/ELoadingPhase__Type/

LewisFarrellDev commented 2 years ago

Also getting this pretty much every time I open the Project. Have to restart 2 or 3 times for it to finally boot and not throw this error :(

paulash commented 2 years ago

I'm having the exact same issue, @paulash did that workaround solved it?

@mastercoms doing some debugging, could it be related to loading the module in another thread, OR the LoadingPhase, that is currently set to "Default"?

https://docs.unrealengine.com/5.0/en-US/API/Runtime/Projects/ELoadingPhase__Type/

Yup, that did indeed work for me. Havent gotten a crash sense.

linqen commented 2 years ago

Yup, that did indeed work for me. Havent gotten a crash sense.

Okay great, I will go with that workaround in the meanwhile. Thanks

mastercoms commented 2 years ago

This is all on UE5 right?

linqen commented 2 years ago

This is all on UE5 right?

In my case, yes

heivoll commented 2 years ago

Just chipping in to say that our team had the same issue, and that the workaround from https://github.com/ProjectBorealis/UEGitPlugin/issues/51#issuecomment-1200437532 fixed it. UE 5.0.3.

sinbad commented 2 years ago

Same, I've had to fork in order to apply this workaround, otherwise this startup crash would bite us every other editor start 🤔 It's quite a nasty one.

mastercoms commented 2 years ago

Yeah, I'll have to test the plugin with UE5 more, since it works fine for UE4. So I'm wondering what changed.

mastercoms commented 2 years ago

I got this once on UE4 as well. So seems like it is much rarer on UE4 but still present. Adding a speculative fix that might work, after investigating.

sinbad commented 2 years ago

I tested out the fix this morning and unfortunately it's not fixed in UE5. I got the same crash on around the 5th restart. The workaround is still the only thing that reliably eliminates the crash so far.

mastercoms commented 2 years ago

In e37691b578d91bee780158b6413fbc92e656a8d3, I have made the workaround part of the build for UE5, so that people don't have to come into this thread to find it :). Will keep trying to figure out what's going on.

sinbad commented 1 year ago

I hate to be the bearer of bad news, but after updating to https://github.com/ProjectBorealis/UEGitPlugin/commit/7d6321da5ebafc732eed1c1e1f604772b0e72541 I got the old startup crash immediately :/ (UE5)

sinbad commented 1 year ago

Wait, sorry, my bad - I think I got mixed up between your release branch and my fork's release branch which wasn't up to date.