2019.3.0b8 freezing in AssetImportManager::Import

Some devs of our team already using the beta is experiencing frequent freezes.
The lock up can happen during startup, or on any asset change or during build.

I attached VS2019 to Unity.exe, and I see the main thread is stuck in AssetImportManager::Import

Here’s the call stack of the main thread:

>    ntdll.dll!NtWaitForSingleObject()    Unknown
     KernelBase.dll!WaitForSingleObjectEx()    Unknown
     Unity.exe!AssetImportManager::Import(class core::hash_map<struct AssetDatabase::ImporterID,struct ImporterInfo,struct core::hash<struct AssetDatabase::ImporterID>,struct std::equal_to<struct AssetDatabase::ImporterID> > const &,struct dynamic_array<struct PostprocessorInfo,0> const &,class AssetResolver &,struct CategorizedAssets &,class IImportProgress *,class core::hash_set<struct UnityGUID,struct core::hash<struct UnityGUID>,struct std::equal_to<struct UnityGUID> > const &,struct LoadedImportedAssetsSnapshot const *,class core::hash_set<class core::basic_string<char,class core::StringStorageDefault<char> >,struct core::hash<class core::basic_string<char,class core::StringStorageDefault<char> > >,struct std::equal_to<class core::basic_string<char,class core::StringStorageDefault<char> > > > &,class CrashedAssetImportsDatabase &,class core::hash_set<struct ArtifactKey,struct core::hash<struct ArtifactKey>,struct std::equal_to<struct ArtifactKey> > &)    Unknown
     Unity.exe!ImportAndPostprocessOutOfDateAssets()    Unknown
     Unity.exe!RefreshInternalV2()    Unknown
     Unity.exe!StopAssetImportingV2()    Unknown
     Unity.exe!RefreshV2(enum AssetDatabase::UpdateAssetOptions)    Unknown
     Unity.exe!AssetDatabase::Refresh(enum AssetDatabase::UpdateAssetOptions)    Unknown
     Unity.exe!Application::InitializeProject(void)    Unknown
     Unity.exe!WinMain()    Unknown
     Unity.exe!__scrt_common_main_seh()    Unknown
     kernel32.dll!00007ff9a1847bd4()    Unknown
     ntdll.dll!RtlUserThreadStart()    Unknown

Disassembly shows:

00007FF7E16F7DF4  call        RemoteAssetCache::GetArtifactFromCacheServerAsync (07FF7E16F5E80h) 
00007FF7E16F7DF9  nop         dword ptr [rax] 
00007FF7E16F7E00  mov         edx,0FFFFFFFFh 
00007FF7E16F7E05  mov         r8d,1 
00007FF7E16F7E0B  mov         rcx,qword ptr [rbp+50h] 
00007FF7E16F7E0F  call        qword ptr [__imp_WaitForSingleObjectEx (07FF7E4BF9C10h)] 
00007FF7E16F7E15  test        eax,eax

I guess it waits for that async fetch to complete…
Editor.log doesn’t contain anything useful.

1 Like

Is this easy to reproduce with some specific assets? Can you make a small project that reproduces this issue? Is the freeze temporary or does it stall forever?
Please submit a bug report if you are able to repro so we can fix it before we release 2019.3.0. Thanks!

There is no fix repro.
It seems to stall forever.
It is called with dwMilliseconds = INFINITE (0xFFFFFFFF) so the WaitForSingleObjectEx won’t timeout.
Sometimes the hang happens at start-up (freezing on the splash screen), but I can get trough by killing Unity and restarting once or twice.
This tells me that this is not a specific asset, or even if it is it’s not happening 100%
The log file doesn’t contain the name of the asset at the point of the freeze so I have no clue which asset it might be.

Right now we are developing with the Cache disabled, which made the issue go away, so this is definitely that (I got the hint from the disassembly above).

I can try to reproduce it locally and make a dump (I forgot to do it last time), and report a bug with that so someone with source access can look at it. I can’t even tell if it is a deadlock or if it is waiting for network or something.

1 Like

I just tried with 2019.3.0f5 and the newest version of Unity Accelerator and I got a hang on my second try.

It created a report with a dump file: (Case 1211678) Hang during import when using Unity Accelerator
Note the report is just an empty project I made so I can send the dump file.
QA will likely close it for lack or repro.

One more information:
After I disconnected Visual Studio 2019 (which I used to make the dump) the import continued.
My guess is that the cache connection timeouted while the Unity process was suspended.

So it looks like an indefinite wait on the cache server, that can be broken by network disconnect (which never happens normally).
Maybe there should be a timeout here. I know there used to be a timeout for v1 cache server (which often happened with older cache server versions)

Thanks for the report! I’ve reached out to the team.