Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Burst 1.8.0-pre.2 infrequently holds a lock on .cs files

Discussion in 'Entity Component System' started by CodeSmile, Aug 26, 2022.

  1. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,533
    Two days ago I updated to Burst 1.8.0-pre.2. After that, from time to time Rider told me it was unable to save the .cs file I was working on. And it couldn't save it seconds later either, nor could I save the file with another text editor - something had a lock on that file, preventing other apps from writing to it. Restarting Unity always fixed that issue, so it had to be something with the Unity editor (2022.1.14f1).

    Today I went back to Burst 1.7.4 because I thought it very likely that Burst could be causing this, and yes, the issue hasn't appeared since in the last 4 hours (it was usually happening within an hour).

    I haven't installed or removed any other packages in that time, nor have I changed Unity editor or Rider versions. It seems pretty clear that Burst 1.8.0 was causing this. However, I did not see any Console errors.

    Let me know if you like to see some logs, I can update Burst and wait for this issue to happen again if it helps.
     
    basobel likes this.
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    Please provide any logging that you have available. This is not something we have seen locally, and honestly not something we would expect, since Burst does not operate on .cs file. It starts work on compiled assemblies.

    With that said, there might be some unexpected interaction happening with the Unity editor. So any additional information you can provide would be greatly appreciated.

    If there is even a way to reliably reproduce this, please submit a bug report: https://unity.com/releases/editor/qa/bug-reporting
     
  3. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    So this has been a problem for me for a while and slowly getting worse over time to the point I'm often seeing it multiple times an hour now. I thought it was a rider issue for a long time but I eventually repoed it with notepad++ and then dug into resource manager and it's definitely unity holding the file handle forever.



    Once the file bugs out it just never releases it until unity.exe is restarted

    I have a very reliable repo of simply spamming some file changes as soon as unity opens and have not been able to repo it while burst is disabled. I'm also pretty sure I started having this in a 1.8.X onwards.

    Video of repo (very boring, mostly just sitting/waiting).



    (I probably should have shown the after effect. Even after unity fully loaded/compiled including burst file is still locked.)

    @JoshPeterson I can probably get you my repo but it's going to be my full project as I don't have a smaller case.

    -edit- just spent another 10min trying to repo with burst disabled without luck so I really am leaning on it being related to burst somehow, even if it's not directly opening the file instead maybe stopping unity/compiler closing file.

    -edit2- one more thing of note is this doesn't seem to happen, at least with anywhere as close a frequency in 2020.3.44 which I use at work but with burst 1.8.x while the above is tested in latest 2022.2.13
     
    Last edited: Apr 3, 2023
  4. Theformand

    Theformand

    Joined:
    Jan 2, 2010
    Posts:
    271
    I'm also seeing this with Unity 2022.2.13 and Burst 1.8.4. Exact same behavior. Visual Studio is randomly unable to save the file that has Burst code in it, and the issue goes away if I disable Burst in Editor.
    Files with no burst code do no exhibit this behavior.
    Once the problem arises, I can usually fix it by reimporting a random script file in the Unity Editor (causing a domain reload). But the issue will pop up again very shortly.

    My layman speculation is, that there is some sort of handoff between the Unity Editor and the burst compiler, and some times Unity doesn't get a proper signal that compilation ended thus never releasing the file lock.

    EDIT: I'm working on a repro project for a bug report, but since finding the workaround with disabling Burst, I have gotten myself into some trouble that I have to get out of again, in order to have a working project :)

    EDIT2: @JoshPeterson I've submitted a bug report and repro project with id : IN-37248 - Let me know if I messed up with generating the project
     
    Last edited: Apr 3, 2023
    JoshPeterson likes this.
  5. Theformand

    Theformand

    Joined:
    Jan 2, 2010
    Posts:
    271
    @tertle I feel your pain. I was also downgrading Visual Studio to several different older versions, downgrading Unity, until it dawned on me that the issue centered around 1 script with Burstable code in it.
     
    tertle likes this.
  6. Theformand

    Theformand

    Joined:
    Jan 2, 2010
    Posts:
    271
    Aaaaand report immediately closed as the case handler couldnt reproduce. After 30 minutes. Great, I guess I'll just live with this horribly annoying issue. I mean, at least give it a try on different systems or something
     
    Last edited: Apr 4, 2023
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    Sorry about that, I've asked our QA team to look at it again, and promote it internally to the Burst team.
     
    Per-Morten, Theformand and Enzi like this.
  8. Theformand

    Theformand

    Joined:
    Jan 2, 2010
    Posts:
    271
    Hey thanks, Josh!
     
  9. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    789
    I recently had the same problem, as soon as I used Bustcompile in a ISystem systems, (I haven't tested any non-ECS projects). After 1-2 compilations, I couldn't save anymore and had to close Unity every time, unfortunately every 5-10 minutes.
     
  10. Theformand

    Theformand

    Joined:
    Jan 2, 2010
    Posts:
    271
    @runner78 The bug has been verified internally by Unity, and they're now working on it. Until a fix is out, disable Burst Compilation in the editor, or trigger a domain reload by importing som random script. At least you wont have to restart Unity :)
     
    runner78 and Per-Morten like this.
  11. Theformand

    Theformand

    Joined:
    Jan 2, 2010
    Posts:
    271
    Just got notice that the bug has been fixed internally, and pending approval slated to land in Burst 1.8.5. Great job, Burst team :)
     
    Per-Morten and Laicasaane like this.
  12. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    Thanks for getting them a repo =)
     
  13. zhoutaosheng-elex

    zhoutaosheng-elex

    Joined:
    Mar 31, 2021
    Posts:
    12
    Do you know how to avoid this issue temporarily, it happens frequently.

    I'm using entites 1.0.0-pre.65 with Unity 2022.2.12
     
  14. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    313
    Theformand already mentioned it: Disable Burst in the Editor. Worked for me.
    upload_2023-4-14_12-17-12.png
     
  15. Heisenburger

    Heisenburger

    Joined:
    Jul 14, 2013
    Posts:
    6
    Is there an ETA for when the fix will be available publicly?
     
    abenfante97 likes this.
  16. zhoutaosheng-elex

    zhoutaosheng-elex

    Joined:
    Mar 31, 2021
    Posts:
    12
    No, currently there isn't.
     
  17. zhuxianzhi

    zhuxianzhi

    Joined:
    Mar 30, 2015
    Posts:
    122
    I've even come across locked folders, 2022.2.14f
     
  18. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    I'm actually having this near constantly but the differences are:
    1. It isn't permanent. If I wait a couple seconds and resave it seems to work
    2. Even disabling compilation on Burst it continues to happen :(

    I don't know if this is related or totally different. I suspected it was the code Generation in ECS causing it?

    Whatever it is, it is definitely EXTREMELY annoying :(
     
  19. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    it happens on my fresh clean U 2022 LTS with entities 1.10 .

    But I have a temp fix that makes life a little less painful: you don't need to kill unity.exe, just press play twice (enter playmode and quit immediately) and the locks are gone.
     
    basobel likes this.
  20. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    I too have this issue every 3 of 5 compiles or so on Linux. More often than not. The only thing that unlocks it is right clicking in the project window. Then closing the menu, then I can refresh. Either that or close unity. I have been having this for like, a year now or more. Longer than I can remember. Kept thinking it was rider, as that's all I use, but I see it happening when just trying to hit Ctrl+R after making a change in vim.
     
  21. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    In case some of us don't read all the thread, the good news was there :

     
    MostHated likes this.
  22. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    313
    basobel and Razmot like this.
  23. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    Edit - Might be something else, nm.
     
    Last edited: Jul 5, 2023