销毁UGroomComponent 发生概率性崩溃

销毁带有物理粒子计算的GroomComponent导致概率性崩溃(低概率)。引擎版本:UE5.3.2

附件是dump 堆栈信息

[Attachment Removed]

我是否需要在需要销毁该组件前做一下FlushRenderingCommands()?

[Attachment Removed]

Hi,

请问你是怎么销毁组件的?正常不需要手动销毁,只需要释放所有引用,GC会自动销毁,且在销毁前会保证渲染线程的资源被释放了(BeginDestroy,IsReadyForFinishDestroy, FinishiDestroy)。

[Attachment Removed]

DestroyActor带有GroomComponent的Actor,然后交给GC了。我们发现渲染线程有在使用UGroomComponent的数据。感觉不是一个安全的数据访问吧?会不会有数据访问冲突的问题?

[Attachment Removed]

能指以下具体的位置吗?理论上BeginDestroy的时候,应该会通知到渲染线程,让其释放引用,等释放后,IsReadyForFinishDestroy才会返回true,才会被释放。

如果有怀疑的地方,可以指一下,我可以再确认一下。

[Attachment Removed]

在RenderThread中访问到了UComponent/UGroomComponent里面的数据。这样是不是存在安全隐患?比如数据(HairGroupInstances)同步的问题。

//ReleaseResources() 在GameThread中执行

void UGroomComponent::ReleaseResources()

{

InitializedResources = nullptr;

HairGroupInstances.Empty();

}

//SetShaderParameters 在渲染线程中执行

void UNiagaraDataInterfaceHairStrands::SetShaderParameters(const FNiagaraDataInterfaceSetShaderParametersContext& Context) const

{

FRDGBuilder& GraphBuilder = Context.GetGraphBuilder();

FNDIHairStrandsProxy& DIProxy = Context.GetProxy<FNDIHairStrandsProxy>();

FNDIHairStrandsData* ProxyData = DIProxy.SystemInstancesToProxyData.Find(Context.GetSystemInstanceID());

// TODO: refactor all of that with if condition

const int32 MeshLODIndex = ProxyData && ProxyData->HairGroupInstance && ProxyData->HairGroupInstance->HairGroupPublicData ? ProxyData->HairGroupInstance->HairGroupPublicData->GetMeshLODIndex() : -1;

const bool bIsHairValid = ProxyData != nullptr && ProxyData->HairStrandsBuffer && ProxyData->HairStrandsBuffer->IsInitialized();

}

麻烦结合上面的堆栈截图看一下哈。是不是存在数据同步的问题?

[Attachment Removed]

Hi,

看了一下文件的历史,这里的确有非常多处crash的修复,这个可能是最相关的 https://github.com/EpicGames/UnrealEngine/commit/af2a6ab4318024b180cfba4a5e3bf072c27368fa,不过我看改动也不少,而且还有多个修复crash的改动,所以如果可能的话,最好能升级引擎,实在不行,就要看一下这个文件的修复历史。

​ [Image Removed]

[Attachment Removed]