Description

When a UPROPERTY() TMap or TArray has raw interface pointers as element type, the garbage collector tries to handle them and crashes.

For raw interface pointers without a container, UHT generates an error at compile-time recommending the TScriptInterface wrapper. This error isn't thrown for containers with raw interface pointers. Consider generating these compile-time errors from UHT as well for containers. Otherwise, the garbage collection runtime error should be addressed.

A repro project has been attached.

Steps to Reproduce

Follow steps on case link with the project attached.

  • Open the project with Unrea Engine Editor 5.4 (from epic games launcher)
  • Start the game
  • Run `gc.CollectGarbageEveryFrame 1` (or wait 60 seconds)
  • The editor crashes during garbage collection
Callstack

[Inlined] UE::GC::TReferenceBatcher::DrainValidated(const unsigned int) GarbageCollection.cpp:1734
UE::GC::TReferenceBatcher::DrainValidatedFull() GarbageCollection.cpp:1796
[Inlined] UE::GC::TReferenceBatcher::DrainUnvalidated(const unsigned int) GarbageCollection.cpp:1687
UE::GC::TReferenceBatcher::DrainUnvalidatedFull() GarbageCollection.cpp:1795
[Inlined] UE::GC::TReferenceBatcher::PushReferenceView(FStridedReferenceView) GarbageCollection.cpp:1574
[Inlined] UE::GC::TReferenceBatcher::DrainStridedArrays(unsigned int) GarbageCollection.cpp:1638
UE::GC::TReferenceBatcher::DrainStridedArraysFull() GarbageCollection.cpp:1794
[Inlined] UE::GC::TReferenceBatcher::PushArray(FStridedReferenceArray) GarbageCollection.cpp:1560
[Inlined] UE::GC::TBatchDispatcher::QueueArray(const UObject *, UE::GC::Private::FStridedReferenceArray &&, FMemberId, EKillable) GarbageCollection.cpp:3223
[Inlined] UE::GC::TBatchDispatcher::HandleKillableArray(UE::GC::Private::FStridedReferenceArray &&, FMemberId, EOrigin) GarbageCollection.cpp:3114
[Inlined] UE::GC::Private::VisitMembers(UE::GC::TBatchDispatcher<…> &, FSchemaView, UObject *) FastReferenceCollector.h:648
[Inlined] UE::GC::TFastReferenceCollector::ProcessObjects(UE::GC::TBatchDispatcher<…> &, TArrayView<…>) FastReferenceCollector.h:956
UE::GC::TFastReferenceCollector::ProcessObjectArray(UE::GC::FWorkerContext &) FastReferenceCollector.h:867
[Inlined] UE::GC::FRealtimeGC::CollectReferencesForGC::__l3::<lambda_1>::operator()(void *, UE::GC::FWorkerContext &) GarbageCollection.cpp:3984
`UE::GC::FRealtimeGC::CollectReferencesForGC<UE::GC::TReachabilityCollector<5>,UE::GC::TReachabilityProcessor<5> >'::`3'::<lambda_1>::<lambda_invoker_cdecl>(void *,UE::GC::FWorkerContext &) GarbageCollection.cpp:3984
[Inlined] UE::GC::ProcessAsync::__l8::<lambda_1>::operator()() GarbageCollection.cpp:6809
[Inlined] Invoke(<lambda_1> &) Invoke.h:47
UE::Tasks::Private::TExecutableTaskBase<`UE::GC::ProcessAsync'::`8'::<lambda_1>,void,void>::ExecuteTask() TaskPrivate.h:855
UE::Tasks::Private::FTaskBase::TryExecuteTask() TaskPrivate.h:504
[Inlined] UE::Tasks::Private::FTaskBase::Init::__l2::<lambda_1>::operator()() TaskPrivate.h:184
[Inlined] LowLevelTasks::FTask::Init::__l13::<lambda_1>::operator()(const bool) Task.h:499
[Inlined] Invoke(LowLevelTasks::FTask::<lambda_1> &, bool &) Invoke.h:47
[Inlined] LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`UE::Tasks::Private::FTaskBase::Init'::`2'::<lambda_1> >'::`13'::<lambda_1>,0>::Call(void *,bool) TaskDelegate.h:162
LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`UE::Tasks::Private::FTaskBase::Init'::`2'::<lambda_1> >'::`13'::<lambda_1>,0>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> &,void *,unsigned int,bool) TaskDelegate.h:171
[Inlined] LowLevelTasks::TTaskDelegate::CallAndMove(LowLevelTasks::TTaskDelegate<…> &, bool) TaskDelegate.h:308
LowLevelTasks::FTask::ExecuteTask() Task.h:627
LowLevelTasks::FScheduler::ExecuteTask(LowLevelTasks::FTask *) Scheduler.cpp:155
[Inlined] LowLevelTasks::FScheduler::TryExecuteTaskFrom(LowLevelTasks::Private::FWaitEvent *, LowLevelTasks::Private::TLocalQueueRegistry<…>::TLocalQueue *, LowLevelTasks::Private::FOutOfWork &, bool) Scheduler.cpp:362
LowLevelTasks::FScheduler::WorkerMain(LowLevelTasks::Private::FWaitEvent *, LowLevelTasks::Private::TLocalQueueRegistry<…>::TLocalQueue *, unsigned int, bool) Scheduler.cpp:397
[Inlined] LowLevelTasks::FScheduler::CreateWorker::__l2::<lambda_1>::operator()() Scheduler.cpp:70
[Inlined] Invoke(<lambda_1> &) Invoke.h:47
UE::Core::Private::Function::TFunctionRefCaller<`LowLevelTasks::FScheduler::CreateWorker'::`2'::<lambda_1>,void __cdecl(void)>::Call(void *) Function.h:405
[Inlined] UE::Core::Private::Function::TFunctionRefBase::operator()() Function.h:555
FThreadImpl::Run() Thread.cpp:66
FRunnableThreadWin::Run() WindowsRunnableThread.cpp:146
FRunnableThreadWin::GuardedRun() WindowsRunnableThread.cpp:71

Have Comments or More Details?

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

0
Login to Vote

Unresolved
ComponentUE - Foundation - Core
Affects Versions5.4.4
Target Fix5.6
CreatedOct 1, 2024
UpdatedOct 10, 2024
View Jira Issue