You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/SurfaceData/Code/Source
mbalfour d7f10e9d60 [LYN-2878] Attempt to fix deadlocks that occur when the Editor loads surface tag assets.
I wasn't able to reproduce the deadlock, but from the reported callstack, the following lock inversion happens:
* EditorSurfaceDataSystemComponent::OnCatalogLoaded locked the AssetCatalogRequestBus mutex by calling EnumerateAssets, and then locked m_assetMutex inside GetAsset->FindOrCreateAsset inside the enumerate callback.
* Loading threads would lock m_assetMutex in AssetManager::ValidateAndRegisterAssetLoading, then lock the AssetCatalogRequestBus inside the Asset<T> copy constructor when calling UpdateDebugStatus when the constructor calls SetData->UpgradeAssetInfo->UpdateAssetInfo->AssetCatalogRequestBus::GetAssetInfoById

This should solve the lock inversion on both sides of the problem:
* UpdateDebugStatus now takes in a const ref instead of a copy, so the copy constructor isn't called.
* EditorSurfaceDataSystemComponent::OnCatalogLoaded is rewritten to call GetAsset outside of the enumeration call.

As a bonus, this also removes the blocking load call.  The rest of the code already supports asynchronous refreshes as the list assets are added / modified / removed, so this code was changed to leverage the asynchronous refreshes as well.
5 years ago
..
Components Integrating github/staging through commit ab87ed9 5 years ago
Editor [LYN-2878] Attempt to fix deadlocks that occur when the Editor loads surface tag assets. 5 years ago
SurfaceDataEditorModule.cpp Integrating github/staging through commit ab87ed9 5 years ago
SurfaceDataEditorModule.h Initial commit 5 years ago
SurfaceDataModule.cpp Integrating github/staging through commit ab87ed9 5 years ago
SurfaceDataModule.h Initial commit 5 years ago
SurfaceDataSystemComponent.cpp Integrating github/staging through commit ab87ed9 5 years ago
SurfaceDataSystemComponent.h Initial commit 5 years ago
SurfaceDataUtility.cpp Integrating github/staging through commit ab87ed9 5 years ago
SurfaceData_precompiled.cpp Initial commit 5 years ago
SurfaceData_precompiled.h Initial commit 5 years ago
SurfaceTag.cpp Integrating github/staging through commit ab87ed9 5 years ago
TerrainSurfaceDataSystemComponent.cpp Initial commit 5 years ago
TerrainSurfaceDataSystemComponent.h Initial commit 5 years ago