Error: Unhandled exception - EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000040

I’ve got this error which causes crash anytime the game mode is loaded. I must have some bad reference or something in there. I was refactoring and brought over some code from another class into the game mode, and this may have broken some references to interfaces or a global event dispatcher plugin I am using. Thats just a guess.

I have version control and can just revert the thing, but it is still going to cost me a couple hours work.

Is there any way I can pinpoint the exact line of code or something, open the thing in c++ editor and remove the offender? I am not a c++ programmer but I can follow instructions if there is a clear target.

Some other thoughts - should I make commits a lot more often? A couple hours of work isn’t the end of the world but it was high-effort refactoring and everything I did hasn’t completely gelled in my brain yet if you know what I mean. Most of the time when I am coding I don’t like to stop or get distracted because I’ll lose my train of thought. Do any of you who have more experience, especially professionals, have any important habits for committing? It sucks to lose work but the same time, stopping every ten minutes to write a commit message seems arduous.

Maybe I shouldn’t have so much code in the game mode either? I had spread more out but it became arduous to communicate between so many different classes when there wasn’t a strong need. So I condensed a lot of stuff to just happen in the game mode. Perhaps that was a mistake.

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000040

UE4Editor_Kismet!<lambda_b01ad580df792538c1e3dbe20ae01a29>::operator()() [D:\Build\++UE4\Sync\Engine\Source\Editor\Kismet\Private\BlueprintCompilationManager.cpp:2590]
UE4Editor_Kismet!FBlueprintCompilationManagerImpl::FastGenerateSkeletonClass() [D:\Build\++UE4\Sync\Engine\Source\Editor\Kismet\Private\BlueprintCompilationManager.cpp:2811]
UE4Editor_Kismet!FBlueprintCompilationManagerImpl::FlushCompilationQueueImpl() [D:\Build\++UE4\Sync\Engine\Source\Editor\Kismet\Private\BlueprintCompilationManager.cpp:936]
UE4Editor_Kismet!FBlueprintCompilationManager::FlushCompilationQueue() [D:\Build\++UE4\Sync\Engine\Source\Editor\Kismet\Private\BlueprintCompilationManager.cpp:3075]
UE4Editor_CoreUObject!FScopedClassDependencyGather::~FScopedClassDependencyGather() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\Blueprint\BlueprintSupport.cpp:454]
UE4Editor_CoreUObject!FLinkerLoad::CreateExport() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:4954]
UE4Editor_CoreUObject!FLinkerLoad::CreateExportAndPreload() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3586]
UE4Editor_CoreUObject!FLinkerLoad::LoadAllObjects() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3757]
UE4Editor_CoreUObject!LoadPackageInternal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1354]
UE4Editor_CoreUObject!<lambda_60b579202fb5d33c88c934eb986e8011>::operator()() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3122]
UE4Editor_CoreUObject!FLinkerLoad::VerifyImportInner() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3230]
UE4Editor_CoreUObject!FLinkerLoad::VerifyImport() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2803]
UE4Editor_CoreUObject!FLinkerLoad::VerifyImportInner() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3258]
UE4Editor_CoreUObject!FLinkerLoad::VerifyImport() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2803]
UE4Editor_CoreUObject!FLinkerLoad::Verify() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2575]
UE4Editor_CoreUObject!FLinkerLoad::FinalizeCreation() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2418]
UE4Editor_CoreUObject!FLinkerLoad::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:816]
UE4Editor_CoreUObject!FLinkerLoad::CreateLinker() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:478]
UE4Editor_CoreUObject!GetPackageLinker() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Linker.cpp:820]
UE4Editor_CoreUObject!LoadPackageInternal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1245]
UE4Editor_CoreUObject!<lambda_60b579202fb5d33c88c934eb986e8011>::operator()() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3122]
UE4Editor_CoreUObject!FLinkerLoad::VerifyImportInner() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3230]
UE4Editor_CoreUObject!FLinkerLoad::VerifyImport() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2803]
UE4Editor_CoreUObject!FLinkerLoad::Verify() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2575]
UE4Editor_CoreUObject!FLinkerLoad::FinalizeCreation() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2418]
UE4Editor_CoreUObject!FLinkerLoad::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:816]
UE4Editor_CoreUObject!FLinkerLoad::CreateLinker() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:478]
UE4Editor_CoreUObject!GetPackageLinker() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Linker.cpp:820]
UE4Editor_CoreUObject!LoadPackageInternal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1245]
UE4Editor_CoreUObject!<lambda_60b579202fb5d33c88c934eb986e8011>::operator()() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3122]
UE4Editor_CoreUObject!FLinkerLoad::VerifyImportInner() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3230]
UE4Editor_CoreUObject!FLinkerLoad::VerifyImport() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2803]
UE4Editor_CoreUObject!FLinkerLoad::VerifyImportInner() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3258]
UE4Editor_CoreUObject!FLinkerLoad::VerifyImport() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2803]
UE4Editor_CoreUObject!FLinkerLoad::Verify() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2575]
UE4Editor_CoreUObject!FLinkerLoad::FinalizeCreation() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2418]
UE4Editor_CoreUObject!FLinkerLoad::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:816]
UE4Editor_CoreUObject!FLinkerLoad::CreateLinker() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:478]
UE4Editor_CoreUObject!GetPackageLinker() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Linker.cpp:820]
UE4Editor_CoreUObject!LoadPackageInternal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1245]
UE4Editor_CoreUObject!LoadPackage() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1469]
UE4Editor_CoreUObject!ResolveName() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:791]
UE4Editor_CoreUObject!StaticLoadObjectInternal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:853]
UE4Editor_CoreUObject!StaticLoadObject() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:928]
UE4Editor_ContentBrowserAssetDataSource!ContentBrowserAssetData::EditOrPreviewAssetFileItems() [D:\Build\++UE4\Sync\Engine\Plugins\Editor\ContentBrowser\ContentBrowserAssetDataSource\Source\ContentBrowserAssetDataSource\Private\ContentBrowserAssetDataCore.cpp:287]
UE4Editor_ContentBrowserAssetDataSource!ContentBrowserAssetData::EditOrPreviewItems() [D:\Build\++UE4\Sync\Engine\Plugins\Editor\ContentBrowser\ContentBrowserAssetDataSource\Source\ContentBrowserAssetDataSource\Private\ContentBrowserAssetDataCore.cpp:318]
UE4Editor_ContentBrowserAssetDataSource!UContentBrowserAssetDataSource::BulkEditItems() [D:\Build\++UE4\Sync\Engine\Plugins\Editor\ContentBrowser\ContentBrowserAssetDataSource\Source\ContentBrowserAssetDataSource\Private\ContentBrowserAssetDataSource.cpp:1030]
UE4Editor_ContentBrowser!SContentBrowser::OnItemsActivated() [D:\Build\++UE4\Sync\Engine\Source\Editor\ContentBrowser\Private\SContentBrowser.cpp:2281]
UE4Editor_ContentBrowser!TBaseSPMethodDelegateInstance<0,SContentBrowser,0,void __cdecl(TArrayView<FContentBrowserItem const ,int>,enum EAssetTypeActivationMethod::Type),FDefaultDelegateUserPolicy>::Execute() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:290]
UE4Editor_ContentBrowser!SAssetView::OnListMouseButtonDoubleClick() [D:\Build\++UE4\Sync\Engine\Source\Editor\ContentBrowser\Private\SAssetView.cpp:3548]
UE4Editor_ContentBrowser!TBaseSPMethodDelegateInstance<0,SAssetView,0,void __cdecl(TSharedPtr<FAssetViewItem,0>),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:307]
UE4Editor_ContentBrowser!TDelegate<void __cdecl(TSharedPtr<FAssetViewItem,0>),FDefaultDelegateUserPolicy>::ExecuteIfBound<void,0>() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:599]
UE4Editor_ContentBrowser!SListView<TSharedPtr<FAssetViewItem,0> >::Private_OnItemDoubleClicked() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Public\Widgets\Views\SListView.h:1074]
UE4Editor_ContentBrowser!STableRow<TSharedPtr<FAssetViewItem,0> >::OnMouseButtonDoubleClick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Public\Widgets\Views\STableRow.h:461]
UE4Editor_Slate!FEventRouter::Route<FReply,FEventRouter::FBubblePolicy,FPointerEvent,<lambda_2b5148752c2a272000c47b69ff14a42e> >() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:378]
UE4Editor_Slate!FSlateApplication::RoutePointerDoubleClickEvent() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:5297]
UE4Editor_Slate!FSlateApplication::ProcessMouseButtonDoubleClickEvent() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:5284]
UE4Editor_Slate!FSlateApplication::OnMouseDoubleClick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:5247]
UE4Editor_ApplicationCore!FWindowsApplication::ProcessDeferredMessage() [D:\Build\++UE4\Sync\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:2209]
UE4Editor_ApplicationCore!FWindowsApplication::DeferMessage() [D:\Build\++UE4\Sync\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:2698]
UE4Editor_ApplicationCore!FWindowsApplication::ProcessMessage() [D:\Build\++UE4\Sync\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:1881]
UE4Editor_ApplicationCore!FWindowsApplication::AppWndProc() [D:\Build\++UE4\Sync\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:905]
user32
user32
UE4Editor_ApplicationCore!FWindowsPlatformApplicationMisc::PumpMessages() [D:\Build\++UE4\Sync\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsPlatformApplicationMisc.cpp:125]
UE4Editor!FEngineLoop::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4850]
UE4Editor!GuardedMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:178]
UE4Editor!GuardedMainWrapper() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
UE4Editor!LaunchWindowsStartup() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:273]
UE4Editor!WinMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:320]
UE4Editor!__scrt_common_main_seh() [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

I’ve nuked the game mode and rebuilt it in a totally different way.

A day later, after closing the project and reopening the following day, I get the same crash on trying to load the game mode blueprint.

I’ve submitted a bug report to epic, but this is a big problem now It is halting work and I can’t begin to debug if I cannot open the blueprint itself. The crash log doesn’t indicate anything to me.

What can I do besides roll back commits and guess?

Summary:
I found a variable in one actor component that would cause a crash if I attempted to delete it.
This actor component was referenced by the game mode, and the game mode would cause a crash if it is loaded.
The player controller also caused a crashed when loaded.
Some hidden link between these three classes must have been corrupted somehow - simply deleting them from the project fixed the issue ( I rolled back version control but when the problem occured was so far back, it was easier just to redo these couple of classes).
Not too much time lost this time however because I’ve separated out logic contained in game mode and player controller into many actor components with single responsibilities, so it’s just a matter of redoing a few functions.

Exact cause of the problem remains unknown, but I expect it has to do with changing the type of a variable while it is already in use - especially in the case of map variables. In both cases, it seems also related to interface usage as well. Just guessing, but those are the common links I can identify.

So after the crash the first time, I decided that in interest of not losing as much work, I should divide the code in the game mode into various components so that if there is a problem it won’t effect entire class. This has helped because I’ve found that it is not the game mode which is a problem, only one variable in one component attached to the game mode:

Something with this Map variable got screwy. If I delete it, it causes the crash. It must be something like a bad pointer, because I had created the variable and then later changed it, which meant I had to go to a few places and refresh the node. But in this case, it got funky.

So, in order to not lose some much work, I can just create an alternate version of this component and copy over everything but the bad variable. And because its just one component with only one function in it, that’s easy to do.