Description

AbilitySystemComponent crashes when RemoveActiveGameplayEffect is called during world teardown for an active gameplay effect that ticks periodically, by unsafe GetWorld()->GetTimerManager() access with GetWorld() returning null. Found in 5.1.1, reproducable in 5.2.0 candidate.

Steps to Reproduce

Client created repro project is attached. I recommend launching that project, opening the map 'PersistentMap', then starting and stopping PIE.

Otherwise, manual repro instructions:

  • Create a GameplayAbility GA_CrashRepro that applies a GameplayEffect GE_CrashRepro to another actor
  • Keep a reference to the other actor in GA_CrashRepro
  • Configure GE_CrashRepro to be a periodic effect
  • On GA_CrashRepro's OnEndAbility, call RemoveActiveGameplayEffect on the other actor to remove all effects of class GE_CrashRepro
  • Start PIE
  • Stop PIE
  • This should repro the crash
Callstack

>    UnrealEditor-Engine.dll!UWorld::GetTimerManager() Line 3960    C++
     UnrealEditor-GameplayAbilities.dll!FActiveGameplayEffectsContainer::InternalRemoveActiveGameplayEffect(int Idx, int StacksToRemove, bool bPrematureRemoval) Line 3592    C++
     UnrealEditor-GameplayAbilities.dll!FActiveGameplayEffectsContainer::RemoveActiveEffects(const FGameplayEffectQuery & Query, int StacksToRemove) Line 4476    C++
     UnrealEditor-GameplayAbilities.dll!UAbilitySystemComponent::RemoveActiveGameplayEffectBySourceEffect(TSubclassOf<UGameplayEffect> GameplayEffect, UAbilitySystemComponent * InstigatorAbilitySystemComponent, int StacksToRemove) Line 1077    C++
     UnrealEditor-GameplayAbilities.dll!UAbilitySystemComponent::execRemoveActiveGameplayEffectBySourceEffect(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1004    C++
     UnrealEditor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 6455    C++
     UnrealEditor-CoreUObject.dll!UObject::CallFunction(FFrame & Stack, void * const Z_Param__Result, UFunction * Function) Line 1129    C++
     [Inline Frame] UnrealEditor-CoreUObject.dll!FFrame::Step(UObject *) Line 467    C++
     UnrealEditor-CoreUObject.dll!UObject::ProcessContextOpcode(FFrame & Stack, void * const Z_Param__Result, bool bCanFailSilently) Line 3139    C++
     [Inline Frame] UnrealEditor-CoreUObject.dll!FFrame::Step(UObject *) Line 467    C++
     UnrealEditor-CoreUObject.dll!ProcessLocalScriptFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1199    C++
     UnrealEditor-CoreUObject.dll!ProcessScriptFunction<void (_cdecl*)(UObject *,FFrame &,void *)>(UObject * Context, UFunction * Function, FFrame & Stack, void * const Z_Param_Result, void[Image Removed](UObject *, FFrame &, void *) ExecFtor) Line 1029    C++
     UnrealEditor-CoreUObject.dll!ProcessLocalFunction(UObject * Context, UFunction * Fn, FFrame & Stack, void * const Z_Param__Result) Line 1269    C++
     [Inline Frame] UnrealEditor-CoreUObject.dll!FFrame::Step(UObject *) Line 467    C++
     UnrealEditor-CoreUObject.dll!ProcessLocalScriptFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1199    C++
     UnrealEditor-CoreUObject.dll!UObject::ProcessInternal(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1296    C++
     UnrealEditor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 6455    C++
     UnrealEditor-CoreUObject.dll!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 2127    C++
     UnrealEditor-GameplayAbilities.dll!UGameplayAbility::K2_OnEndAbility(bool bWasCancelled) Line 604    C++
     UnrealEditor-GameplayAbilities.dll!UGameplayAbility::EndAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo * ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateEndAbility, bool bWasCancelled) Line 637    C++
     UnrealEditor-GameplayAbilities.dll!UGameplayAbility::CancelAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo * ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateCancelAbility) Line 584    C++
     UnrealEditor-GameplayAbilities.dll!UAbilitySystemComponent::CancelAbilitySpec(FGameplayAbilitySpec & Spec, UGameplayAbility * Ignore) Line 1113    C++
     [Inline Frame] UnrealEditor-GameplayAbilities.dll!UAbilitySystemComponent::CancelAbilities(const FGameplayTagContainer *) Line 1100    C++
     UnrealEditor-GameplayAbilities.dll!UAbilitySystemComponent::DestroyActiveState() Line 1156    C++
     UnrealEditor-Engine.dll!UActorComponent::ExecuteUnregisterEvents() Line 1707    C++
     UnrealEditor-Engine.dll!UActorComponent::UnregisterComponent() Line 1423    C++
     UnrealEditor-Engine.dll!AActor::UnregisterAllComponents(bool bForReregister) Line 5166    C++
     UnrealEditor-Engine.dll!ULevel::ClearLevelComponents() Line 1376    C++
     UnrealEditor-Engine.dll!UWorld::ClearWorldComponents() Line 2254    C++
     UnrealEditor-Engine.dll!UWorld::CleanupWorldInternal(bool bSessionEnded, bool bCleanupResources, bool bWorldChanged) Line 4975    C++
     UnrealEditor-Engine.dll!UWorld::CleanupWorld(bool bSessionEnded, bool bCleanupResources, UWorld * NewWorld) Line 4914    C++
     UnrealEditor-UnrealEd.dll!UEditorEngine::TeardownPlaySession(FWorldContext & PieWorldContext) Line 873    C++
     UnrealEditor-UnrealEd.dll!UEditorEngine::EndPlayMap() Line 339    C++
     UnrealEditor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 2210    C++
     UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 517    C++
     UnrealEditor.exe!FEngineLoop::Tick() Line 5369    C++
     [Inline Frame] UnrealEditor.exe!EngineTick() Line 66    C++

Have Comments or More Details?

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

0
Login to Vote

Fixed
ComponentUE - Gameplay - Gameplay Ability System
Affects Versions5.05.15.2
Target Fix5.3
Fix Commit24495977
CreatedMar 2, 2023
ResolvedMar 9, 2023
UpdatedSep 21, 2023
View Jira Issue