Search Unity

Exception occurred inside BeeDriver

Discussion in 'Editor & General Support' started by TheSheepdog, Jul 12, 2021.

  1. TheSheepdog

    TheSheepdog

    Joined:
    Apr 6, 2014
    Posts:
    6
    I'm getting this error and cant make sense of it.

    Exception occurred inside BeeDriver: System.IO.IOException: Sharing violation on path D:\Unity Projects\Game\Library\Bee\tundra.log.json
    at System.IO.File.Delete (System.String path) [0x00073] in <695d1cc93cca45069c528c15c9fdd749>:0
    at NiceIO.NPath+SystemIOFileSystem.File_Delete (NiceIO.NPath path) [0x00007] in <e404e719d459428eb55f62322ea61ee7>:0
    at NiceIO.NPath+WindowsFileSystem.File_Delete (NiceIO.NPath path) [0x0001b] in <e404e719d459428eb55f62322ea61ee7>:0
    at NiceIO.NPath.Delete (NiceIO.DeleteMode deleteMode) [0x0002c] in <e404e719d459428eb55f62322ea61ee7>:0
    at NiceIO.NPath.DeleteIfExists (NiceIO.DeleteMode deleteMode) [0x00012] in <e404e719d459428eb55f62322ea61ee7>:0
    at Bee.BeeDriver.RunBackendPhase.Start () [0x00037] in <e404e719d459428eb55f62322ea61ee7>:0
    at Bee.BeeDriver.BeeDriver.StartPhase (Bee.BeeDriver.PhaseBase phase) [0x00007] in <e404e719d459428eb55f62322ea61ee7>:0
    at Bee.BeeDriver.WriteBuildProgramDataPhase.Tick () [0x00050] in <e404e719d459428eb55f62322ea61ee7>:0
    at Bee.BeeDriver.PhaseBase.Tick (System.Boolean blocked) [0x00009] in <e404e719d459428eb55f62322ea61ee7>:0
    at Bee.BeeDriver.BeeDriver.Tick (System.Boolean block) [0x00000] in <e404e719d459428eb55f62322ea61ee7>:0
     
    Terrible-Turkey likes this.
  2. kpro1982

    kpro1982

    Joined:
    May 16, 2021
    Posts:
    3
    In searching for an answer to a similar question I found the following command to address asset IO sharing violations. I'm not sure if they will help you but it might be worth reviewing the manual on these.
    AssetDatabase.ReleaseCachedFileHandles();
    AssetDatabase.DisallowAutoRefresh();
     
  3. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    527
    Having the same show-stopping error on 2021.1.15, can't compile.
     
  4. NicolasIceberg

    NicolasIceberg

    Joined:
    Feb 14, 2020
    Posts:
    1
    It seems like not only I have this issue.

    My observations: The way I have been fixing it so far is by restarting an entire computer. The issue seems to be caused by the file [your unity folder]/[version]/Editor/Data/bee_backend.exe. This starts a process bee_backend.exe, which, after unity exits or this error occurs, seems to be impossible to kill.

    BTW: The obvious question - who the hell named these two? What do bees have to do with tundras in a game engine?
     
    Last edited: Jul 22, 2021
    ammarajam08 and Terrible-Turkey like this.
  5. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    If any of you have a computer or project which can reproduce this issue please let me know. I would very much like to investigate this further. In particular @NicolasIceberg case where the process can't be killed is interesting. If it only happens sporadically, please take the opportunity next time it happens to file a bug report and attach a .dmp file of bee_backend.exe. You can create a dump file from Windows Task Manager by right-clicking bee_backend.exe and selecting "Create dump file".

    If you already filed a case let me know the case no and I will investigate.
     
    TheSheepdog likes this.
  6. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    527
    I had this showstopper when using Hub 3.0 Beta, though it's prolly unrelated. I did reinstall Hub 2.4.4 and reinstall 2021.1.15, then this Bee exception disappeared.
    It's obviously a big one, I thought my project's gone to the dogs.
     
    TheSheepdog likes this.
  7. TheSheepdog

    TheSheepdog

    Joined:
    Apr 6, 2014
    Posts:
    6
    Is there another way to send you the DMP file? It's nearly 3 GB and Unity's bug report hoses up at 54%. I have tried several times and it wont go.

    Thanks
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Put it in a 7z file and compress it using "best" compression. It should make it 20 times smaller.
     
    TheSheepdog likes this.
  9. TheSheepdog

    TheSheepdog

    Joined:
    Apr 6, 2014
    Posts:
    6
    I've been trying all week. The bug report takes a few hours to get to 50% and the rest of the night to get to 54% then fails. The error this time says "Unable to write". The DMP file is packed with 7z and compressed to 7 Mb but is still doing the same thing.
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    You could also put it on google drive/dropbox and just drop a link in the bug report.
     
    TheSheepdog likes this.
  11. TheSheepdog

    TheSheepdog

    Joined:
    Apr 6, 2014
    Posts:
    6
    I didn't realize that it was uploading my entire project folder. After removing that folder, it submitted in about 2 minutes. Thanks!
     
  12. KingAustin

    KingAustin

    Joined:
    Jan 12, 2016
    Posts:
    20
    idk if i had the exact same error but in my case i just had a strange program that was accessing that file.
    i went in to the folder system to delete that file and it told me what program was accessing that file so i went into task manager and terminated that program which resolved the issue in my case.

    i think it was bee something handler.exe or something or background or similar word to that

    [edit]
    it was bee_backend.exe
    its also odd because i had to force shutdown unity because the script compilation hanged and would not complete even after 10 minuets so i assume it was left behind
     
    Last edited: Jan 22, 2022
  13. Tiger_2k

    Tiger_2k

    Joined:
    Jan 16, 2016
    Posts:
    4
    It also just happened to me after upgrading a project from Unity 2021.1.28 to 2021.2.8.

    The bug seems reproducible every time on a mac that runs a gitlab-runner, that starts our build script.

    Are there any news on this issue?

    Thanks.
     
    kniewolewski likes this.
  14. matt-FLG

    matt-FLG

    Joined:
    Oct 3, 2018
    Posts:
    3
    Getting the same error after upgrading a project from Unity 2021.1.28 to 2021.2.8 also building with Jenkins.

    Please help ?
     
  15. kniewolewski

    kniewolewski

    Joined:
    Nov 30, 2016
    Posts:
    3
    Did anyone resolve the issue? I upgraded Unity from 2021.1.27 to 2021.2.10 (on 2021.2.9 it's the same). I'm also able to reproduce the issue 100% on a mac with automated build process, but I don't have this issue building locally in Editor on windows or mac. I'm getting:

    Code (CSharp):
    1. Exception occurred inside BeeDriver: System.IO.IOException: Sharing violation on path /Users/vagrant/git/UnityProject/[Unknown]
    2.   at System.IO.FileStream.WriteInternal (System.Byte[] src, System.Int32 offset, System.Int32 count) [0x00077] in <e7b4371ec0dc4ed2ab84299cc150e9c3>:0
    3.   at System.IO.FileStream.Write (System.Byte[] array, System.Int32 offset, System.Int32 count) [0x00090] in <e7b4371ec0dc4ed2ab84299cc150e9c3>:0
    4.   at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00080] in <e7b4371ec0dc4ed2ab84299cc150e9c3>:0
    5.   at System.IO.StreamWriter.WriteSpan (System.ReadOnlySpan`1[T] buffer, System.Boolean appendNewLine) [0x000a7] in <e7b4371ec0dc4ed2ab84299cc150e9c3>:0
    6.   at System.IO.StreamWriter.WriteLine (System.String value) [0x0000d] in <e7b4371ec0dc4ed2ab84299cc150e9c3>:0
    7.   at System.IO.TextWriter+SyncTextWriter.WriteLine (System.String value) [0x00000] in <e7b4371ec0dc4ed2ab84299cc150e9c3>:0
    8.   at (wrapper synchronized) System.IO.TextWriter+SyncTextWriter.WriteLine(string)
    9.   at System.Console.WriteLine (System.String value) [0x00000] in <e7b4371ec0dc4ed2ab84299cc150e9c3>:0
    10.   at Bee.BeeDriver.RunningProgram.get_HasExited () [0x00086] in <7d5b346e100b493a8d2db4abd4098568>:0
    11.   at Bee.BeeDriver.RunBackendPhase.Tick () [0x0001b] in <7d5b346e100b493a8d2db4abd4098568>:0
    12.   at Bee.BeeDriver.PhaseBase.Tick (System.Boolean blocked) [0x00009] in <7d5b346e100b493a8d2db4abd4098568>:0
    13.   at Bee.BeeDriver.BeeDriver.Tick (System.Boolean block) [0x00000] in <7d5b346e100b493a8d2db4abd4098568>:0
    14. #0 GetStacktrace(int)
    15. #1 DebugStringToFile(DebugStringToFileData const&)
    16. #2 DebugLogHandler_CUSTOM_Internal_Log(LogType, LogOption, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*)
    17. #3  (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    18.  
    19. BuildFailedException: Incremental Player build failed!
    20.   at UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) [0x00165] in /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/BeeBuildPostprocessor.cs:559
    21.   at UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) [0x00001] in /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:28
    22.   at UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) [0x00009] in <d0b2474c7e244b3982f42b52c1ccc4c1>:0
    23.   at UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) [0x000e5] in /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370
    24. UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[], Boolean)
    25. UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:448)
    26. UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:347)
    27. UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:321)
     
  16. Michael-ClockStone

    Michael-ClockStone

    Joined:
    Jan 18, 2012
    Posts:
    90
    I have the exact same problem on our command line driven Mac Build Server with Unity 2021.2.10. I can solve it by restarting MacOSX, but the problem comes again as soon as I want to build a second time. It is during a
    CopyFiles operation. Unfortunately the log doesn't show what files it tried to copy.
     
  17. austinborden

    austinborden

    Joined:
    Aug 5, 2016
    Posts:
    24
    Running into this as well on OSX doing a command line build (Unity 2021.2.11). Same stack trace as the post above. What exactly is the Bee process? Can we turn it off?
     
  18. Michael-ClockStone

    Michael-ClockStone

    Joined:
    Jan 18, 2012
    Posts:
    90
    Bee is doing IL2CPP, so you can't turn it off unfortunately
     
  19. mightysky

    mightysky

    Joined:
    Aug 13, 2018
    Posts:
    3
    Same issue appears when we try to make a build on Jenkins running on MacOS. Unity 2022.1.0b11. Same issue was with Unity 2021.2.x.

    Code (CSharp):
    1. [2105/2440  0s] CopyFiles /Users/jenkins/workspace/omittedprojectname/Library/Bee/Android/Prj/IL2CPP/Il2CppBackup/il2cppOutput/UnityEngine.XRModule.cpp
    2. [2106/2440  0s] CopyFiles /Users/jenkins/workspace/omittedprojectname/Library/Bee/Android/Prj/IL2CPP/Il2CppBackup/il2cppOutput/UnityEngine.VRModule.cpp
    3. [2107/2440  0s] CopyFiles /Users/jenkins/workspace/omittedprojectname/Library/Bee/Android/Prj/IL2CPP/Il2CppBackup/il2cppOutput/UnityEngine.UIModule.cpp
    4. [2108/2440  0s] CopyFiles /Users/jenkins/workspace/omittedprojectnameException occurred inside BeeDriver: System.IO.IOException: Sharing violation on path /Users/jenkins/workspace/omittedprojectname/[Unknown]
    5.   at System.IO.FileStream.WriteInternal (System.Byte[] src, System.Int32 offset, System.Int32 count) [0x00077] in <5c11b4a72acd40aeb3dee4e6d69cca92>:0
    6.   at System.IO.FileStream.Write (System.Byte[] array, System.Int32 offset, System.Int32 count) [0x00090] in <5c11b4a72acd40aeb3dee4e6d69cca92>:0
    7.   at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00080] in <5c11b4a72acd40aeb3dee4e6d69cca92>:0
    8.   at System.IO.StreamWriter.WriteSpan (System.ReadOnlySpan`1[T] buffer, System.Boolean appendNewLine) [0x000a7] in <5c11b4a72acd40aeb3dee4e6d69cca92>:0
    9.   at System.IO.StreamWriter.WriteLine (System.String value) [0x0000d] in <5c11b4a72acd40aeb3dee4e6d69cca92>:0
    10.   at System.IO.TextWriter+SyncTextWriter.WriteLine (System.String value) [0x00000] in <5c11b4a72acd40aeb3dee4e6d69cca92>:0
    11.   at (wrapper synchronized) System.IO.TextWriter+SyncTextWriter.WriteLine(string)
    12.   at System.Console.WriteLine (System.String value) [0x00000] in <5c11b4a72acd40aeb3dee4e6d69cca92>:0
    13.   at Bee.BeeDriver.RunningProgram.get_HasExited () [0x00086] in <80f74dcb76a84216bd73c350f5758fd4>:0
    14.   at Bee.BeeDriver.RunBackendPhase.Tick () [0x0001b] in <80f74dcb76a84216bd73c350f5758fd4>:0
    15.   at Bee.BeeDriver.PhaseBase.Tick (System.Boolean blocked) [0x00009] in <80f74dcb76a84216bd73c350f5758fd4>:0
    16.   at Bee.BeeDriver.BeeDriver.Tick (System.Boolean block) [0x00000] in <80f74dcb76a84216bd73c350f5758fd4>:0
    17. UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
    18. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    19. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    20. UnityEngine.Debug:LogError (object)
    21. UnityEditor.Modules.BeeBuildPostprocessor:ReportBuildResults (Bee.BeeDriver.BeeDriverResult) (at /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/BeeBuildPostprocessor.cs:512)
    22. UnityEditor.Modules.BeeBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs) (at /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/BeeBuildPostprocessor.cs:594)
    23. UnityEditor.Modules.DefaultBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&) (at /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:28)
    24. UnityEditor.Android.AndroidBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&)
    25. UnityEditor.PostprocessBuildPlayer:Postprocess (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,string,string,string,int,int,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370)
    26. UnityEditor.BuildPipeline:BuildPlayerInternal (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:480)
    27. UnityEditor.BuildPipeline:BuildPlayer (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:358)
    28. UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:322)
    29. AndroidBuilder:BuildAndroidAABInternal (string) (at Assets/Editor/Builders/AndroidBuilder.cs:131)
    30. AndroidBuilder:BuildAndroidAAB () (at Assets/Editor/Builders/AndroidBuilder.cs:83)
    31.  
    32. (Filename: /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/BeeBuildPostprocessor.cs Line: 512)
    33.  
    34. Uploading Crash Report
    35. BuildFailedException: Incremental Player build failed!
    36.   at UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) [0x00165] in /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/BeeBuildPostprocessor.cs:610
    37.   at UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) [0x00001] in /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:28
    38.   at UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) [0x00009] in <023c38e344e541f3b4075f8346f5d26c>:0
    39.   at UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) [0x000e5] in /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370
    40. UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[], Boolean)
    41. UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:480)
    42. UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:358)
    43. UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:322)
    44. AndroidBuilder:BuildAndroidAABInternal(String) (at Assets/Editor/Builders/AndroidBuilder.cs:131)
    45. AndroidBuilder:BuildAndroidAAB() (at Assets/Editor/Builders/AndroidBuilder.cs:83)
    46.  
    47. (Filename: /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/BeeBuildPostprocessor.cs Line: 610)
    48.  
    49. Unloading 264 Unused Serialized files (Serialized files now loaded: 0)
    50. Unloading 1587 unused Assets / (413.5 KB). Loaded Objects now: 48199.
    51. Memory consumption went from 1.06 GB to 1.06 GB.
    52. Total: 304.913204 ms (FindLiveObjects: 8.372641 ms CreateObjectMapping: 7.718980 ms MarkObjects: 277.177844 ms  DeleteObjects: 11.640926 ms)
    53.  
    54. Build Finished, Result: Failure.
    We really need help or workaround for this issue.

    Attempts to make a build (sometimes we got lucky):
    builderror.png
     
    Last edited: Mar 15, 2022
    Unity_ChenXi and kniewolewski like this.
  20. bezokawzrok

    bezokawzrok

    Joined:
    Jul 4, 2020
    Posts:
    2
    @Tautvydas-Zilys
    We have the same issue on (2021.2.10) using Bitrise (running on MacOS), basically after updating we need to switch to building locally on Windows (we build only Android, so on iOS that may be a deal breaker). Any updates on that issue?
     
  21. bezokawzrok

    bezokawzrok

    Joined:
    Jul 4, 2020
    Posts:
    2
  22. ADAMKOLO1985

    ADAMKOLO1985

    Joined:
    Mar 11, 2022
    Posts:
    1
    I am also experiencing this issue. Any news about it?
     
  23. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Hi,

    we have seen recurring reports of this issue, which always involve some kind of external CI or build automation. My suspicion is that such CI setups use a mechanism to redirect console standard output which the dotnet console handling is not happy about.

    Unfortunately, I have not seen any way to reproduce this yet. I would need a project folder - and the exact steps to reproduce the CI environment. If anyone can upload that to a bug report and post the case number here, that would help a lot.
     
    Last edited: Mar 23, 2022
  24. tarrantulla

    tarrantulla

    Joined:
    Apr 30, 2019
    Posts:
    5
    Hi @jonas-echterhoff, I sent a bug report for this issue at start of February and included a Unity project with it and reproduction steps regarding what files the Unity project should have for the issue to trigger. The case number is 1400689 and it got closed as someone from your side replied the issue is already tracked here: https://issuetracker.unity3d.com/is...t-ioexception-sharing-violation-on-path-error . After not hearing from you guys in a while I also added the same repro steps in that issue's comments. So the project folder is already in my case (1400689). Should I add steps for reproducing CI environment where since I can't comment the case straight in fogbugz? Also is there any other additional info you would need that I have not provided yet with my ticket?
     
    Last edited: Mar 25, 2022
  25. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    You can respond directly to the fogbugz email and it will add your message to the bug notes automatically. But you can comment here too, whatever is more convenient.
     
  26. tarrantulla

    tarrantulla

    Joined:
    Apr 30, 2019
    Posts:
    5
    Hey @Tautvydas-Zilys and @jonas-echterhoff. I have now added info about our CI environment to the case number 1400689. Let me know if you need additional info or something is unclear :)
     
  27. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Thank you, that is very useful. Currently trying to reproduce the setup.
     
  28. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Ok, here's an update. I was able to reproduce the Azure CI setup described by @juho_unity , and using that was able to reproduce the bug.

    It turns out that the bug is fixed in latest builds of Unity 2022.2.

    What I _think_ is going on:
    -Your build script redirects Unity log output to stdout (using `-logFile /dev/stdout` on the editor command line, if i remove that, all is good!)
    -the CI buildagent client pipes stdout to some sort of log file to be uploaded to the CI as artifacts
    -that pipe probably has some limited buffer size
    -Our incremental build code will write the entire build backend log output to the editor.log file in a single write operation when the build is finished
    -This big write exceeds the pipe buffer size, causing an error

    The change in Unity 2022.2 which turns out to fix this is to write build output log lines to the editor log as they come in rather than in one big batch. We will consider if that change is safe to backport to current release versions of Unity.
     
  29. Miguel_FirstLight

    Miguel_FirstLight

    Joined:
    Apr 9, 2020
    Posts:
    19
    Thank you so much for the explanation.
    Unfortunately we don't use -logFile /dev/stdout` on the editor command line

    This error is making our builds crash 80% of the time. Waiting for the 2022.2 (December) release makes this really unbearable and big problem for our studio.

    How complicated would it be to make it backport to 2021.2 or 2021.3 or 2022.1? (I'm assuming that those releases are sooner to come)

    And if not backported, how can studios like ours manage this? How to increase the Jenkins limited buffer size? Is there a fix we can do it ourselves until the Unity release?

    Thank you
     
  30. tarrantulla

    tarrantulla

    Joined:
    Apr 30, 2019
    Posts:
    5
    Hey @jonas-echterhoff thanks for the insights! We are now able to avoid the build error by collecting logs to a different log file inside the work folder and show the logs from the file in a new task after the Unity build task is done.
     
  31. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Are you using third party tools which set up the unity command line? If not, are you 100% sure that you have the same issue? Do you have a log file you can share?

    I think it is very clear that a backport is needed. We need to figure out some details about what the best fix is, but will figure out something.
     
  32. Miguel_FirstLight

    Miguel_FirstLight

    Joined:
    Apr 9, 2020
    Posts:
    19
    I wouldn't mind sharing my Jenkins setup, but I did a search on our entire Unity project and Jenkins for the "-logFile /dev/stdout" quote and couldn't find anywhere.

    we don't use any special third parties, from Facebook, Firebase, Photon, Appsflyer, SRDebugger,...

    This is the error log.
    We notice happens more frequently on Android builds or when 2 builds are running at the same time


    [Error][ 724/2389 0s] CopyFiles /Users/firstlight/.jenkins/workspace/blast-royale-manuException occurred inside BeeDriver:
    System.IO.IOException: Sharing violation on path /Users/firstlight/.jenkins/workspace/blast-royale-manual-android-dev/[Unknown]
    at System.IO.FileStream.WriteInternal (System.Byte[] src, System.Int32 offset, System.Int32 count) [0x00077] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    at System.IO.FileStream.Write (System.Byte[] array, System.Int32 offset, System.Int32 count) [0x00090] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00080] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    at System.IO.StreamWriter.WriteSpan (System.ReadOnlySpan`1[T] buffer, System.Boolean appendNewLine) [0x000a7] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    at System.IO.StreamWriter.WriteLine (System.String value) [0x0000d] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    at System.IO.TextWriter+SyncTextWriter.WriteLine (System.String value) [0x00000] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    at (wrapper synchronized) System.IO.TextWriter+SyncTextWriter.WriteLine(string)
    at System.Console.WriteLine (System.String value) [0x00000] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    at Bee.BeeDriver.RunningProgram.get_HasExited () [0x00086] in <7d5b346e100b493a8d2db4abd4098568>:0
    at Bee.BeeDriver.RunBackendPhase.Tick () [0x0001b] in <7d5b346e100b493a8d2db4abd4098568>:0
    at Bee.BeeDriver.PhaseBase.Tick (System.Boolean blocked) [0x00009] in <7d5b346e100b493a8d2db4abd4098568>:0
    at Bee.BeeDriver.BeeDriver.Tick (System.Boolean block) [0x00000] in <7d5b346e100b493a8d2db4abd4098568>:0
    [Exception] BuildFailedException: Incremental Player build failed!
    Build Step 2 - Initializing : 00:00:00.0004826
    Build Step 2 - Check gradle project collisions : 00:00:00.0003984
    Build Step 2 - Preparing banner : 00:00:00.0005287
    Build Step 2 - Setup incremental player build : 00:00:01.0998443
    Build Step 2 - Incremental player build : 00:00:36.6496840
    Build Step 2 - Report output files : 00:00:00.0020325
    UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
    UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    UnityEngine.Logger:Log (UnityEngine.LogType,object)
    UnityEngine.Debug:Log (object)
    FirstLight.Editor.Build.Builder:LogBuildReport (UnityEditor.Build.Reporting.BuildReport) (at Assets/Src/FirstLight/Editor/Build/Builder.cs:162)
    FirstLight.Editor.Build.Builder:JenkinsBuild ()

     
    Last edited: Mar 31, 2022
  33. mightysky

    mightysky

    Joined:
    Aug 13, 2018
    Posts:
    3
    We have made WORKAROUND for this issue on our build machine (jenkins) for 100% successful builds by redirecting logs to separate log file.

    Execute shell command:
    Code (csharp):
    1.  
    2. echo "Starting Unity build..."
    3. /var/lib/jenkins/Unity/Hub/Editor/2022.1.0b11/Editor/Unity -projectPath $WORKSPACE -quit -batchmode -nographics -buildTarget Android -executeMethod AndroidBuilder.BuildAndroidAAB -serial $UNITY_SERIAL -username $UNITY_USERNAME -password $UNITY_PASSWORD > $WORKSPACE/out.log 2>&1
    4. cat $WORKSPACE/out.log
    5.  
     
  34. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Yes, that certainly looks like the same problem. If you want, share the full log in a bug report and paste the case number here, so I can take a look to see if I spot anything notable about the log setup.
     
  35. Miguel_FirstLight

    Miguel_FirstLight

    Joined:
    Apr 9, 2020
    Posts:
    19
    Thank you.
    This is the bug report: https://fogbugz.unity3d.com/default.asp?1416463_vv8blld35e4i2ofm
     
  36. Miguel_FirstLight

    Miguel_FirstLight

    Joined:
    Apr 9, 2020
    Posts:
    19
  37. chakie

    chakie

    Joined:
    Jul 31, 2011
    Posts:
    14
    So this bug is not yet solved and does not have a reliable workaround? I'm seeing the same when building an Android package using the new 2021.3.0f1 LTS version for ARM Macs. I build using Fastlane on my Mac, so no CI involved at all. Updating to some random 2022 beta version is not an option.
     
  38. XEDORA

    XEDORA

    Joined:
    Jul 8, 2015
    Posts:
    12
    Unity must prioritize this issue to the highest level. This blocks developers migrating 2021 LTS.
     
  39. AnMill

    AnMill

    Joined:
    Sep 5, 2018
    Posts:
    8
    In my case on Mac it was fixed by

    Code (Boo):
    1. cd /Applications/Unity/Hub/Editor
    2.  
    3. # Put your version of Unity
    4. sudo chmod -R +x 2021.3.2f1
     
  40. ColdFire_JimRaid

    ColdFire_JimRaid

    Joined:
    Jun 11, 2019
    Posts:
    3
    Is there any other workaround yet?
    Still having this issue after redirecting logs or changing the permissions of unity doesn't help with Unity 2021.3.3f1


    Code (Boo):
    1. [ 633/2340  0s] CopyFiles gradle_build/build/uniException occurred inside BeeDriver: System.IO.IOException: Sharing violation on path /Users/buildserver/builds/URC7sUL-/0/hikingmanager/hiking-manager-client/[Unknown]
    2.   at System.IO.FileStream.WriteInternal (System.Byte[] src, System.Int32 offset, System.Int32 count) [0x00077] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    3.   at System.IO.FileStream.Write (System.Byte[] array, System.Int32 offset, System.Int32 count) [0x00090] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    4.   at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00080] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    5.   at System.IO.StreamWriter.WriteSpan (System.ReadOnlySpan`1[T] buffer, System.Boolean appendNewLine) [0x000a7] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    6.   at System.IO.StreamWriter.WriteLine (System.String value) [0x0000d] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    7.   at System.IO.TextWriter+SyncTextWriter.WriteLine (System.String value) [0x00000] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    8.   at (wrapper synchronized) System.IO.TextWriter+SyncTextWriter.WriteLine(string)
    9.   at System.Console.WriteLine (System.String value) [0x00000] in <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0
    10.   at Bee.BeeDriver.RunningProgram.get_HasExited () [0x00086] in <d437a509b48443e2b0df1aa39920f891>:0
    11.   at Bee.BeeDriver.RunBackendPhase.Tick () [0x0001b] in <d437a509b48443e2b0df1aa39920f891>:0
    12.   at Bee.BeeDriver.PhaseBase.Tick (System.Boolean blocked) [0x00009] in <d437a509b48443e2b0df1aa39920f891>:0
    13.   at Bee.BeeDriver.BeeDriver.Tick (System.Boolean block) [0x00000] in <d437a509b48443e2b0df1aa39920f891>:0
     
  41. Aquablue

    Aquablue

    Joined:
    Dec 15, 2013
    Posts:
    11
    The following solved the issue in our CI system. Maybe the trick also works for you.

    When invoking Unity from the command line, if not already present, add the log file -logFile argument and give an absolute path as value.

    Example (I've omitted a lot of parameters to make things easier to understand) of how we invoke Unity from a mac build agent:
    /Applications/Unity/Hub/Editor/2021.3.1f1/Unity.app/Contents/MacOS/Unity -nographics -batchmode -logFile /Users/<username removed>/Home/workspace/<project name removed>/Build/Editor.log
     
  42. unity_30DBF0A230761360A2DB

    unity_30DBF0A230761360A2DB

    Joined:
    Jun 13, 2022
    Posts:
    1
    Got it working by moving logFile from /dev/stdout to /dev/job.log and added cat job.log once process finishes.
     
  43. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    This issue is still not fixed on 2021.3.7f1, the latest LTS version available, despite it being marked as fixed in issue 1397693. Can you please confirm the status of this issue?

    Here is the relevant excerpt from the build log. macOS. Command line argument is `-logFile`, which results in build log going to stdout.

    Code (CSharp):
    1.  
    2. (Filename: Assets/Editor/Build.cs Line: 121)
    3.  
    4. ***OUTPUT***Error Exception occurred inside BeeDriver: System.IO.IOException: Sharing violation on path /Users/builder/clone/Client/[Unknown]
    5.   at System.IO.FileStream.WriteInternal (System.Byte[] src, System.Int32 offset, System.Int32 count) [0x00077] in <5e2d116f98d140d0a76ec8a673a2a4ac>:0
    6.   at System.IO.FileStream.Write (System.Byte[] array, System.Int32 offset, System.Int32 count) [0x00090] in <5e2d116f98d140d0a76ec8a673a2a4ac>:0
    7.   at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00080] in <5e2d116f98d140d0a76ec8a673a2a4ac>:0
    8.   at System.IO.StreamWriter.WriteSpan (System.ReadOnlySpan`1[T] buffer, System.Boolean appendNewLine) [0x0016b] in <5e2d116f98d140d0a76ec8a673a2a4ac>:0
    9.   at System.IO.StreamWriter.WriteLine (System.String value) [0x0000d] in <5e2d116f98d140d0a76ec8a673a2a4ac>:0
    10.   at System.IO.TextWriter+SyncTextWriter.WriteLine (System.String value) [0x00000] in <5e2d116f98d140d0a76ec8a673a2a4ac>:0
    11.   at (wrapper synchronized) System.IO.TextWriter+SyncTextWriter.WriteLine(string)
    12.   at System.Console.WriteLine (System.String value) [0x00000] in <5e2d116f98d140d0a76ec8a673a2a4ac>:0
    13.   at Bee.BeeDriver.SystemProcessRunnableProgram.StartImpl (System.String workingDirectory, System.String[] arguments) [0x0015a] in <8090e176693344d890ff5ce732f8fade>:0
    14.   at Bee.BeeDriver.RunnableProgram.Start (System.String workingDirectory, System.String[] arguments) [0x00000] in <8090e176693344d890ff5ce732f8fade>:0
    15.   at Bee.BeeDriver.PhaseBase.StartAndSetActiveProcess (Bee.BeeDriver.RunnableProgram program, System.String[] args) [0x00059] in <8090e176693344d890ff5ce732f8fade>:0
    16.   at Bee.BeeDriver.RunBuildProgramPhase.StartImpl () [0x0008a] in <8090e176693344d890ff5ce732f8fade>:0
    17.   at Bee.BeeDriver.PhaseBase.Start () [0x00006] in <8090e176693344d890ff5ce732f8fade>:0
    18.   at Bee.BeeDriver.BeeDriver.StartPhase (Bee.BeeDriver.PhaseBase phase) [0x00034] in <8090e176693344d890ff5ce732f8fade>:0
    19.   at Bee.BeeDriver.RunBackendPhase.Tick () [0x001bc] in <8090e176693344d890ff5ce732f8fade>:0
    20.   at Bee.BeeDriver.PhaseBase.Tick (System.Boolean blocked) [0x00009] in <8090e176693344d890ff5ce732f8fade>:0
    21.   at Bee.BeeDriver.BeeDriver.Tick (System.Boolean block) [0x00000] in <8090e176693344d890ff5ce732f8fade>:0
    22. UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
    23. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    24. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    25. UnityEngine.Debug:Log (object)
    26. BuildScript:BuildAndroid () (at Assets/Editor/Build.cs:121)
     
  44. TebogoWesi

    TebogoWesi

    Joined:
    Aug 12, 2014
    Posts:
    159
    In your saved project folder go to Library/bee and delete the entire bee folder. Unity will rebuild a new one.
     
  45. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Thank you, that worked, just ran into that BEE error, whiling doing scene layout. No coding, importing or anything just designing a level.. suddenly Bee exception..

    Working on 2021.3.11f1 LTS..
     
    ChiuanWei likes this.
  46. Mr12Fingers

    Mr12Fingers

    Joined:
    Dec 26, 2012
    Posts:
    18
    Thank you TebogoWesi. That fixed it. Previously I was rebuilding the entire library folder and it was a massive pain.
     
  47. aplusm

    aplusm

    Joined:
    May 4, 2018
    Posts:
    4
    We're still running into this issue while building for Android on Jenkins with Unity 2021.3.19f1.

    Can you please confirm the status of this issue?
     
  48. ChisaiDev

    ChisaiDev

    Joined:
    Oct 16, 2021
    Posts:
    10
    Hey guys, I recreated this error by forcing Unity to close well exporting a while.
    Im using URP myself and for me i have to uninstall URP and reinstall it and it fixed it for me. Looks like its an error on the graphical memory side
     
  49. mostynb

    mostynb

    Unity Technologies

    Joined:
    Apr 6, 2020
    Posts:
    1
    We landed a potential mitigation for this error in the following Unity versions:
    2021.3.23f1
    2022.2.16f1
    2023.1.0b13

    Is anyone still hitting this issue with these versions (or newer)?
     
  50. razvan_stancu

    razvan_stancu

    Joined:
    Dec 8, 2022
    Posts:
    1
    Looks like upgrading from 2021.3.18f1 to 2021.3.23f1 solved the problem
     
    mostynb likes this.