Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  3. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

2019.3.0b8 freezing in AssetImportManager::Import

Discussion in '2019.3 Beta' started by Hyp-X, Oct 25, 2019.

  1. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    438
    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:

    Code (CSharp):
    1. >    ntdll.dll!NtWaitForSingleObject()    Unknown
    2.      KernelBase.dll!WaitForSingleObjectEx()    Unknown
    3.      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
    4.      Unity.exe!ImportAndPostprocessOutOfDateAssets()    Unknown
    5.      Unity.exe!RefreshInternalV2()    Unknown
    6.      Unity.exe!StopAssetImportingV2()    Unknown
    7.      Unity.exe!RefreshV2(enum AssetDatabase::UpdateAssetOptions)    Unknown
    8.      Unity.exe!AssetDatabase::Refresh(enum AssetDatabase::UpdateAssetOptions)    Unknown
    9.      Unity.exe!Application::InitializeProject(void)    Unknown
    10.      Unity.exe!WinMain()    Unknown
    11.      Unity.exe!__scrt_common_main_seh()    Unknown
    12.      kernel32.dll!00007ff9a1847bd4()    Unknown
    13.      ntdll.dll!RtlUserThreadStart()    Unknown
    14.  
    Disassembly shows:

    Code (CSharp):
    1. 00007FF7E16F7DF4  call        RemoteAssetCache::GetArtifactFromCacheServerAsync (07FF7E16F5E80h)
    2. 00007FF7E16F7DF9  nop         dword ptr [rax]
    3. 00007FF7E16F7E00  mov         edx,0FFFFFFFFh
    4. 00007FF7E16F7E05  mov         r8d,1
    5. 00007FF7E16F7E0B  mov         rcx,qword ptr [rbp+50h]
    6. 00007FF7E16F7E0F  call        qword ptr [__imp_WaitForSingleObjectEx (07FF7E4BF9C10h)]
    7. 00007FF7E16F7E15  test        eax,eax  
    I guess it waits for that async fetch to complete...
    Editor.log doesn't contain anything useful.
     
    LeonhardP likes this.
  2. charlesb_rm

    charlesb_rm

    Joined:
    Jan 18, 2017
    Posts:
    485
    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!
     
  3. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    438
    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.
     
    LeonhardP likes this.
  4. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    438
    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)
     
  5. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Thanks for the report! I've reached out to the team.