Search Unity

Stuck at Initial Asset Database refresh (v2)

Discussion in 'Asset Database' started by KAJed, Jul 14, 2020.

  1. KAJed

    KAJed

    Joined:
    Mar 15, 2013
    Posts:
    122

    Attached Files:

  2. KAJed

    KAJed

    Joined:
    Mar 15, 2013
    Posts:
    122
    Here is an example with deleting the library. It's been stuck on this file for... well you can see.

    upload_2020-7-16_6-38-55.png
     
  3. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,135
    Could you please submit a bug report for this issue, ideally with a reproduction project? Looks like a different problem with similar symptoms to the one you referenced. The fix for that went into 2020.2a12.
     
  4. KAJed

    KAJed

    Joined:
    Mar 15, 2013
    Posts:
    122
    They both still occur. In this case if I delete everything: .vs folder, project files, UserSetttings folder, Library, obj folder, and leave only the basics I can get it to open again. Then upon opening another time the "Initial Asset Database Refresh" occurs again. I will try to give send the repro project if I can get it to open again.

    Note that just deleting the library leaves me in the previously 8hour long state.

    EDIT: Case number 1263658
     
    Last edited: Jul 16, 2020
  5. RadianSmile

    RadianSmile

    Joined:
    Jul 24, 2015
    Posts:
    3
    After I paste some asset into the Assets/ folder which doesn't have file extension, I encountered this problem. I simply deleted the wrong file, and it works again.
     
  6. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    65
    I'm experiencing huge delays now due to this same issue in Unity 2020.1.6f1, and it's causing me hours of lost time, having restart Unity constantly.
     
  7. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,135
    There's a known issue that causes a performance regression during domain reload when the package manager window is open (floating or docked). Could you please try and check whether the issue still occurs when the packman window is off?

    https://issuetracker.unity3d.com/product/unity/issues/guid/1270910/

    If it still happens, It would be helpful if you could submit a bug report for the issue with a reproduction project. It's unlikely to be the same issue as the ones mentioned earlier in the thread. Those have been fixed in the version that you mention.
     
    DoctorShinobi likes this.
  8. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    65
    I don't personally leave the package manager window open, so the issue isn't that.

    Unfortunately I can't provide a repro project because our project is massive.

    The issue I'm seeing is happening any time a script recompile is required, and it's not just the AssetDatabase.Refresh that gets caught for 6+ minutes, it also gets caught on "Importing Assets" and a couple of others that I can't recall off the top of my head.
     
  9. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    65
    And just to expand on this a little further... it's getting to the point where I'm losing hours of time every day because of this (it's happening every second time I run our project now, so I'm restarting 50+ times a day), and I can't wind back to 2019.x or go forward to 2020.2. I'm stuck in limbo with this until a resolution comes along.

    I'd be more than happy to get on a call with a developer at Unity and walk them through what's happening.
     
  10. KAJed

    KAJed

    Joined:
    Mar 15, 2013
    Posts:
    122
    Are you by chance using Odin Inspector? If you are not, are you perhaps doing any Type scanning / attribute scanning inside of a static constructor or even through InitializeOnLoad/InitializeOnLoadMethod?

    Odin Inspector has since found a workaround but the culprit in their case is that during those times Unity has not fully loaded assembly information and querying one assembly that may load another can cause a deadlock. From my recent experience Unity has a number of issues related to Assembly reload / settle including but not limited to the issue you're having as well as certain assets being displayed as "None" in the inspector.
     
    andreiagmu and LeonhardP like this.
  11. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    65
    Yes I am actually using Odin Inspector, and I try to avoid any initialise on load behaviours.

    Would you happen to know off the top of your head where the information regarding Odin's workaround is located? Is it on their forum?
     
  12. KAJed

    KAJed

    Joined:
    Mar 15, 2013
    Posts:
    122
    It's not. I don't think it was officially announced in any way as not everyone was having issues. I did help them work through the issue though and the fix required changing some initialization for types and attributes at the core of Odin. Ideally Unity would fix this issue but so far they claim to not be able to reproduce it even when I sent a project that 100% reproduced for me.

    I cannot recall if it was back-ported to the 2.1.13 release. Your best bet is to hop on to the Discord and ask their staff if that fix is in 2.1.x or if it's only addressed in the new beta (which is what I'm using).
     
  13. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    65
    Thanks KAJed,

    I was thinking about trying out the 3.0 beta anyway, so I might do that and see if the issue persists, and then contact them on Discord if I'm still seeing the issue.
     
  14. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    65
    I grabbed the 3.0.0.3 beta and I'm still seeing the issue, so I've sent them a message in Discord. It'd be such a relief to have this issue resolved - it's getting to the point where I'm wanting to just walk away from my PC all the time now when it happens.
     
    Last edited: Sep 25, 2020
  15. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,135
    FYI, today we've shared a blog post and started a dedicated thread to increase awareness of the primary causes for slow asset refreshes. We will use the thread to share additional known issues as they come to light and keep you updated about our progress on resolving related issues on our end.
     
    Sarudan and mahdi_jeddi like this.
  16. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Reinstalled windows and can't open project again. Unity 2020.3.13 Unity stuck at Load Scripting Assemblies.

    upload_2021-7-3_14-4-53.png

    Last log line is:
    Application.AssetDatabase Initial Script Refresh Start
    I don't know what to do.
     
  17. LosTChG

    LosTChG

    Joined:
    Apr 7, 2015
    Posts:
    7
    Hello.

    FYI, in my case it was resolved by changing permissions of the folders involved, giving full control to the user. Somehow the permissions were corrupted while installing a new operating system.

    Also, removing some .meta files was needed in order to Unity to recognise some files.
     
  18. chrpetry

    chrpetry

    Joined:
    Mar 7, 2018
    Posts:
    65
    Just now I had the problem of being stuck at "Initial Asset Database refresh".
    My temporal workaround is to set the command line attribute -DisableDirectoryMonitor.
    At least the editor opens up again now.
    Not sure what this means for me.
    It is not documented here https://docs.unity3d.com/Manual/EditorCommandLineArguments.html
     
    fqueiroz, fnnbrr and andreiagmu like this.
  19. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    175
    That attribute is mentioned in this documentation page:
    https://docs.unity3d.com/2021.1/Doc...setDatabase.IsDirectoryMonitoringEnabled.html
     
  20. hoonsubin

    hoonsubin

    Joined:
    Dec 7, 2017
    Posts:
    3
    I see the same issue as everyone else. But interestingly enough, I only get stuck on Ubuntu. On Windows and Mac, it takes a long time to load, but on Ubuntu, I get stuck forever.
    This issue happens even if I change the Unity editor version. Considering that other projects can load without any problem on Ubuntu, it might be due to a dependency I use (notably Odin Inspector and SuperTiled2Unity, which are probably the heaviest I have).
     
  21. fnnbrr

    fnnbrr

    Joined:
    Jan 26, 2021
    Posts:
    11
    The -DisableDirectoryMonitor command line argument also worked for me. I was trying to open a Unity project containing symlinks in a virtual machine (Windows 10 host, Windows 10 guest, VirtualBox).

    Thanks for the reference, the docs say that "Directory Monitoring is automatically disabled when Unity detects symlinks in the project," but maybe it has trouble detecting them within a VM. Good to know!


    And remember: if you disable Directory Monitoring, you can use Ctrl+R/CMD+R to manually reload from disk.
     
    Last edited: Aug 21, 2022
  22. fqueiroz

    fqueiroz

    Joined:
    May 21, 2021
    Posts:
    5
    Thank you for the advice. It worked for me. Are there any consequences, though?
     
  23. john79

    john79

    Joined:
    Jul 13, 2016
    Posts:
    16
    i just solved this issue, i found out that i had some files and directory with root permission
    chmod -R 777 directory/ ran this commend on the folder and the asset database will work again.
     
  24. Kozsiy

    Kozsiy

    Joined:
    Feb 14, 2023
    Posts:
    6
    Worked for me! Thanks!
     
  25. pxkiwi

    pxkiwi

    Joined:
    Jun 28, 2021
    Posts:
    1
    Currently having similar issue with the project (even the fresh one) on LTS 2022, no matter the version. Loading stucks on Initial Asset Database Refresh and spams editor log file with "Connectivity with IL Post Processor runner cannot be established yet. Retrying."
    Any of abovementioned methods don't work at all. Any ideas how to fix this?
     
    Last edited: Jul 31, 2023
  26. IronHelmet

    IronHelmet

    Joined:
    May 2, 2017
    Posts:
    85
    I had this same issue today (Initial Asset Database refresh) I was attempting to build my library on a brand new harddrive. The first attempt was after deleting the library (~50GB) and "moving" a perforce repository from c:\repository to the new drive d:\repository then opening the project.

    When trying to open the project unity would hang forever doing the database refresh.

    Then I deleted the entire repository and did a fresh sync from perforce, but Unity stalled opening the project again.

    After reading this forum thread I tried -DisableDirectoryMonitor but I didn't fix the problem. But I started to suspect the file system was the problem. I chose exfat for my new drive.

    I reformatted the drive to NTFS and downloaded the project from perforce and unity now seems to be rebuilding the library correctly. (It takes an hour or so.)

    It may have been the exfat filesystem, but it may have just been some other issue with a file in the repository that changed.

    I was surprised to learn that Drobpox will flat out refuse to save your files on exfat and it only supports NTFS. Perhaps perforce or Unity also have problems with exfat.
     
    Last edited: Aug 25, 2023
  27. nzhul

    nzhul

    Joined:
    Apr 29, 2015
    Posts:
    4
    The issue in my case was totally weird.
    I have an .net 5 API project running. That I use to store data for my game.
    When I checked the Editor.log file when I was experiencing the "Initial asset database refresh" issue, I found the following:


    [Licensing::Client] Successfully resolved entitlements
    Application.AssetDatabase Initial Refresh Start
    Unhandled exception. System.InvalidOperationException: Operation is not valid due to the current state of the object.
    at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.GetDisplayName()
    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions.Serialize(Utf8JsonWriter writer)
    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.KestrelEventSource.Configuration(KestrelServerOptions options)
    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.KestrelEventSource.AddServerOptions(KestrelServerOptions options)
    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
    at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
    at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
    at Microsoft.AspNetCore.Builder.WebApplication.Run(String url)
    at Program.<Main>$(String[] args)

    If you ask me how the f*** I get this exception when trying to start the game ... I have no idea, But the thing is that when I stop my API project. I am able to start the Unity game.

    I will try to investigate further, but so far, I have no idea what exactly is causing this problem.
    I tried changing the port of the API from 5000 to something else, but that didn't helped. Good think is that I have a workaround.

    I also tried to run the same project with the same setup on my laptop, and there is no problem there. Soo most definitely something is messed up with my machine.
     
    BestHTTP likes this.
  28. CSEliot

    CSEliot

    Joined:
    May 9, 2014
    Posts:
    33
    This advice is what helped me. Closing a backend api i had running in debug mode in visual studio 2022, was the fix. This 'backend api' project is totally unrelated to anything unity.
     
    Dam-Pete likes this.
  29. kkacperz

    kkacperz

    Joined:
    Jan 25, 2018
    Posts:
    1
    Same, Unity Editor loading hanged on Initial Asset Database refresh step because of backend project running in separate Visual Studio.
    Unity project communicates with backend project via REST api, but only in PlayMode.
    No editor script calls to backend project.
     
    Dam-Pete likes this.
  30. Di_o

    Di_o

    Joined:
    May 10, 2016
    Posts:
    62
    I'm also stuck at Initial Asset Database Refresh sometimes. To fix this I delete all temporary files (Library, Temp. project.sln etc. Then I make sure all unity related ***.exe are closed via Task Manager. Then I make sure no Visual Studio is running.

    That usually fixes it.

    Not sure about the cause of this issue, but Unity.Licensing.Client seems to be stuck for some reason. I have to always terminate it via Task Manager, when this happens
     
    Last edited: Feb 9, 2024
    Dam-Pete likes this.
  31. Takavar

    Takavar

    Joined:
    Mar 8, 2014
    Posts:
    1

    I was having the same issues with getting stuck on initial asset database refresh, I got to this rather old thread here via google search. Completely Closing my Visual Studio which was open for doing some other completely unrelated task to Unity seemed to have solved this problem which persists as of now in Feb 2024.

    Thank you all who have taken the time to write about this issue.
     
    JanSelchow and Dam-Pete like this.
  32. Dam-Pete

    Dam-Pete

    Joined:
    Jun 11, 2010
    Posts:
    54
    WOW! That was it. I always have VS open for other projects (backend, for instance) and I had never noticed this was the issue. Thank you so much, this has been bugging me for so long, I've tried so many things to no avail.
     
    JanSelchow likes this.
  33. Obi0n333

    Obi0n333

    Joined:
    Mar 24, 2021
    Posts:
    1
    Might be worth adding a solution that worked for me, although it takes a bit of time for the reimport:
    1. Delete the library folder within Client and near assets.
    2. Reopen the project via Unity launcher/hub.
    3. Wait a nice long time while it all reimports.
     
  34. unity_6750199558838D63B1B8

    unity_6750199558838D63B1B8

    Joined:
    Jan 10, 2024
    Posts:
    6
    I did this, but it didn't fix the issue. Anyone knows what else to do? I have uninstalled Unity Hub and Editor, completely deleted the project and redownloaded it from the repo. Still the same. Stuck on Initial Asset Database Refresh!
     

    Attached Files: