Description

When a sublevel gets unloaded that has an actor with an AbilitySystemComponent with an active GameplayEffect with Duration, a crash occurs when the duration expires. This is due to an ASC timer delegate executing for an ASC that has been removed from world.

Steps to Reproduce

Fast repro:

  • Download the attached project and load BasicMap. On running in PIE in Standalone it should crash. The repro project does the below steps:

Manual repro:

  • Create a sublevel
  • In that sublevel add an actor that applies a GameplayEffect with duration on itself on BeginPlay
  • In another level, load that sublevel
    • The actor should now apply the GE with duration
  • Immediately unload the sublevel and trigger garbage collection
  • When the GE's duration expires the game crashes due to ASC accessing an invalid World pointer, see callstack

 

Callstack

[Inlined] IsObjectHandleNull(FObjectHandlePrivate) ObjectHandle.h:99
[Inlined] FObjectPtr::operator bool() ObjectPtr.h:180
[Inlined] TObjectPtr<UGameInstance>::operator bool() ObjectPtr.h:627
UWorld::GetTimerManager() World.cpp:6879
FActiveGameplayEffectsContainer::CheckDuration(FActiveGameplayEffectHandle) GameplayEffect.cpp:4612
[Inlined] Invoke(void (UAbilitySystemComponent::*)(FActiveGameplayEffectHandle),UAbilitySystemComponent *&,const FActiveGameplayEffectHandle &) Invoke.h:66
[Inlined] UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int,0>,FActiveGameplayEffectHandle>::ApplyAfter(void (UAbilitySystemComponent::*&)(FActiveGameplayEffectHandle),UAbilitySystemComponent *&) Tuple.h:311
TBaseUObjectMethodDelegateInstance<0,UAbilitySystemComponent,void __cdecl(void),FNotThreadSafeNotCheckedDelegateUserPolicy,FActiveGameplayEffectHandle>::Execute() DelegateInstancesImpl.h:649
[Inlined] TDelegate<void __cdecl(void),FNotThreadSafeNotCheckedDelegateUserPolicy>::Execute() DelegateSignatureImpl.inl:549
FTimerUnifiedDelegate::Execute() TimerManager.h:50
FTimerManager::Tick(float) TimerManager.cpp:930
UWorld::Tick(ELevelTick,float) LevelTick.cpp:1563
UEditorEngine::Tick(float,bool) EditorEngine.cpp:1934
UUnrealEdEngine::Tick(float,bool) UnrealEdEngine.cpp:538
FEngineLoop::Tick() LaunchEngineLoop.cpp:5836
[Inlined] EngineTick() Launch.cpp:61
GuardedMain(const wchar_t *) Launch.cpp:190
LaunchWindowsStartup(HINSTANCE__ *,HINSTANCE__ *,char *,int,const wchar_t *) LaunchWindows.cpp:247
WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int) LaunchWindows.cpp:298
[Inlined] invoke_main() 0x00007ff7fd31c6ea
__scrt_common_main_seh() 0x00007ff7fd31c6c9
<unknown> 0x00007fff56187614
<unknown> 0x00007fff580c26b1

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-196930 in the post.

0
Login to Vote

Fixed
Target Fix5.4
Fix Commit29271936
Main Commit29271947
CreatedOct 2, 2023
ResolvedOct 31, 2023
UpdatedDec 1, 2023
View Jira Issue