[1.24] Crash unloading UI Canvas with an animation

We have a level with 1 entity that references a UI Canvas. That UI Canvas has a scrolling background driven by a sequence that is started by script canvas. When the level unload, the game crashes.

art_sigsegv_fault 0x000000727fd59c70
art::FaultManager::HandleFault(int, siginfo*, void*) 0x000000727fd5a1a8
___lldb_unnamed_symbol181$$app_process64 0x000000653925c13c
0x0000007306c846a0
AZ::Internal::IdHandler<UiElementInterface, UiElementInterface, AZ::Internal::EBusContainer<UiElementInterface, UiElementInterface, (AZ::EBusAddressPolicy)1, (AZ::EBusHandlerPolicy)0> >::BusDisconnect() EBus.h:1302
UiElementComponent::Deactivate() UiElementComponent.cpp:1540
AZ::Internal::IdHandler<UiElementInterface, UiElementInterface, AZ::Internal::EBusContainer<UiElementInterface, UiElementInterface, (AZ::EBusAddressPolicy)1, (AZ::EBusHandlerPolicy)0> >::BusDisconnect() EBus.h:1302
UiElementComponent::Deactivate() UiElementComponent.cpp:1540
AZ::Entity::DeactivateComponent(AZ::Component&) Entity.h:474
AZ::Entity::Deactivate() Entity.cpp:257
UiCanvasComponent::DeactivateElements() UiCanvasComponent.cpp:3486
UiCanvasManager::ReleaseCanvasDeferred(AZ::EntityId) UiCanvasManager.cpp:518
decltype((InvokeTraits::forward<AZ::Internal::HandlerNode<UiCanvasManagerInterface, UiCanvasManagerInterface, AZ::Internal::EBusContainer<UiCanvasManagerInterface, UiCanvasManagerInterface, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&>(fp0)).fp(InvokeTraits::forwardAZ::EntityId&(fp1))) AZStd::Internal::INVOKE<void (UiCanvasManagerInterface::&)(AZ::EntityId), AZ::Internal::HandlerNode<UiCanvasManagerInterface, UiCanvasManagerInterface, AZ::Internal::EBusContainer<UiCanvasManagerInterface, UiCanvasManagerInterface, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&, AZ::EntityId&, void>(void (UiCanvasManagerInterface::&&&)(AZ::EntityId), AZ::Internal::HandlerNode<UiCanvasManagerInterface, UiCanvasManagerInterface, AZ::Internal::EBusContainer<UiCanvasManagerInterface, UiCanvasManagerInterface, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&&&, AZ::EntityId&&&) invoke_traits.h:145
AZStd::invoke_result<void (UiCanvasManagerInterface::&)(AZ::EntityId), AZ::Internal::HandlerNode<UiCanvasManagerInterface, UiCanvasManagerInterface, AZ::Internal::EBusContainer<UiCanvasManagerInterface, UiCanvasManagerInterface, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&, AZ::EntityId&>::type AZStd::invoke<void (UiCanvasManagerInterface::&)(AZ::EntityId), AZ::Internal::HandlerNode<UiCanvasManagerInterface, UiCanvasManagerInterface, AZ::Internal::EBusContainer<UiCanvasManagerInterface, UiCanvasManagerInterface, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&, AZ::EntityId&>(void (UiCanvasManagerInterface::&&&)(AZ::EntityId), AZ::Internal::HandlerNode<UiCanvasManagerInterface, UiCanvasManagerInterface, AZ::Internal::EBusContainer<UiCanvasManagerInterface, UiCanvasManagerInterface, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&&&, AZ::EntityId&&&) invoke.h:42
void AZ::EBusEventProcessingPolicy::Call<void (UiCanvasManagerInterface::
&)(AZ::EntityId), AZ::Internal::HandlerNode<UiCanvasManagerInterface, UiCanvasManagerInterface, AZ::Internal::EBusContainer<UiCanvasManagerInterface, UiCanvasManagerInterface, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&, AZ::EntityId&>(void (UiCanvasManagerInterface::&&&)(AZ::EntityId), AZ::Internal::HandlerNode<UiCanvasManagerInterface, UiCanvasManagerInterface, AZ::Internal::EBusContainer<UiCanvasManagerInterface, UiCanvasManagerInterface, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&&&, AZ::EntityId&&&) Policies.h:434
void AZ::Internal::EBusContainer<UiCanvasManagerInterface, UiCanvasManagerInterface, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::Dispatcher<AZ::EBus<UiCanvasManagerInterface, UiCanvasManagerInterface> >::Broadcast<void (UiCanvasManagerInterface::
)(AZ::EntityId), AZ::EntityId&>(void (UiCanvasManagerInterface::*&&)(AZ::EntityId), AZ::EntityId&&&) BusContainer.h:1372

Any ideas what this could be?

Hi @Ryan_Young
Can you see/test this video tutorial for UI in script canvas? :slightly_smiling_face: I tested this process in 1.18 without problems but did not test for 1.24 :face_with_monocle: if it is possible please let me know in this forum with your feedback in this video tutorial , Thank you :rose: :pray:

Hi @Ryan_Young, is this entity in a dynamic slice? You may also try to replicate this with an empty uicanvas and a level with a single entity in it that references that canvas. That might help narrow down the issue.

I forgot to mention this crashes on Android, but not PC.

Here is our setup. It is a single static entity. Not a slice. It has a UI Canvas Asset Ref component with the ui canvas that is crashing on unload. If I use a blank UI Canvas instead, the game runs fine on Android and PC.

Hi @Ryan_Young, is it possible you have some custom UI elements in the canvas that is crashing or maybe some ScriptCanvas? Iā€™d say the next thing to try is removing some of those elements from the UI Canvas to isolate the issue.

Found the issue with the help of @petrocket.

There is a notification bus event in the script canvas on the ui canvas. The event was triggered by code from a callback from OnDataReceived in the Dynamic Content system. OnDataReceived is not called from the main thread causing issues in script canvas.

The crash is avoided after deferring the call from code to the notification bus in OnDataReceived using QueueFunction.

1 Like