Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Upgrading to Unity.Burst 1.3.4 causes System.InvalidOperationException: Unable to create a SharedSta

Discussion in 'Burst' started by MNNoxMortem, Aug 9, 2020.

  1. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    Today I tried to update some of the dots packages, in particular com.unity.burst 1.3.3 => 1.3.4 seems to cause this exception, but I did noot have the time ot dig deeper
    Code (CSharp):
    1. Unexpected exception System.InvalidOperationException: System.InvalidOperationException: Unable to create a SharedStatic for this key. It is likely that the same key was used to allocate a shared memory with a smaller size while the new size requested is bigger
    2. Thrown from job: Unity.Entities.StructuralChange._mono_to_burst_RemoveComponentEntitiesBatch
    3. This Exception was thrown from a function compiled with Burst, which has limited exception support. Turn off burst (Jobs -> Burst -> Enable Compilation) to inspect full exceptions & stacktraces.
    4.   at (wrapper managed-to-native) System.Object.wrapper_native_00007FFF92C5AA30(Burst.Compiler.IL.Jit.JitBurstInitializeUtility/ResolveExternalFunctionDelegate)
    5.   at Burst.Compiler.IL.Jit.JitBurstInitializeUtility.InvokeBurstInitializeFunction (System.IntPtr initFunctionPointer, System.Collections.Generic.List`1[T] externalFunctions) [0x00045] in <12fd8c57ac5741e888f3e2a61ac3563b>:0
    6.   at Burst.Compiler.IL.Jit.JitCompiler.CompileMethodInternal (Burst.Compiler.IL.Jit.JitResult result, System.Collections.Generic.List`1[T] methodsToCompile, Burst.Compiler.IL.Jit.JitOptions jitOptions) [0x00578] in <12fd8c57ac5741e888f3e2a61ac3563b>:0
    7.   at Burst.Compiler.IL.Jit.JitCompiler.CompileMethods (Mono.Cecil.MethodReference[] methodReferences, Burst.Compiler.IL.Jit.JitOptions jitOptions) [0x00271] in <12fd8c57ac5741e888f3e2a61ac3563b>:0
    8.   at Burst.Compiler.IL.Jit.JitCompiler.CompileMethod (Mono.Cecil.MethodReference methodReference, Burst.Compiler.IL.Jit.JitOptions jitOptions) [0x0001c] in <12fd8c57ac5741e888f3e2a61ac3563b>:0
    9.   at Burst.Compiler.IL.Jit.JitCompilerService+CompilerThreadContext.Compile (Burst.Compiler.IL.Jit.JitCompilerService+CompileJob job) [0x003cb] in <12fd8c57ac5741e888f3e2a61ac3563b>:0
    10.  
    11. While compiling job: System.Void Unity.Entities.StructuralChange::_mono_to_burst_RemoveComponentEntitiesBatch(Unity.Entities.EntityComponentStore*,Unity.Collections.LowLevel.Unsafe.UnsafeList*,System.Int32)
    12. at <empty>:line 0
    13. (Filename:  Line: 0)
    What does this exception mean exactly?
    Has anyone encountered it?
    How can I solve it?
     
    Tony_Max likes this.
  2. vladk

    vladk

    Joined:
    Jul 10, 2008
    Posts:
    167
    Got the same thing today. It looks like 1.3.4 Burst doesn't work with Entity package.

    worked for me rolling back to Burst 1.3.3.
     
    Last edited: Aug 17, 2020
    MNNoxMortem likes this.
  3. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    Just to rule something easy out - did you restart the editor after doing the Burst update or not?
     
  4. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    Yes
     
    sheredom likes this.
  5. Tony_Max

    Tony_Max

    Joined:
    Feb 7, 2017
    Posts:
    334
    Got same error. Burst version is 1.3.2

    UPD: fixed after i have switched to 1.3.4
     
    Last edited: Aug 18, 2020
  6. beevik_

    beevik_

    Joined:
    Sep 27, 2020
    Posts:
    87
    I'm now getting this same error after upgrading to Burst 1.3.9.

    InvalidOperationException: Unable to create a SharedStatic for this key. It is likely that the same key was used to allocate a shared memory with a smaller size while the new size requested is bigger
    Unity.Burst.SharedStatic.GetOrCreateSharedStaticInternal (System.Int64 getHashCode64, System.Int64 getSubHashCode64, System.UInt32 sizeOf, System.UInt32 alignment) (at Library/PackageCache/com.unity.burst@1.3.9/Runtime/SharedStatic.cs:160)
    Unity.Burst.SharedStatic`1[T].GetOrCreate[TContext] (System.UInt32 alignment) (at Library/PackageCache/com.unity.burst@1.3.9/Runtime/SharedStatic.cs:59)
    Unity.Entities.EntityComponentStore..cctor () (at Library/PackageCache/com.unity.entities@0.14.0-preview.19/Unity.Entities/EntityComponentStore.cs:1428)
    Rethrow as TypeInitializationException: The type initializer for ‘Unity.Entities.EntityComponentStore’ threw an exception.
    Unity.Entities.EntityDataAccess.Initialize (Unity.Entities.EntityDataAccess* self, Unity.Entities.World world) (at Library/PackageCache/com.unity.entities@0.14.0-preview.19/Unity.Entities/EntityDataAccess.cs:164)
    Unity.Entities.EntityManager.Initialize (Unity.Entities.World world) (at Library/PackageCache/com.unity.entities@0.14.0-preview.19/Unity.Entities/EntityManager.cs:220)
    Unity.Entities.World..ctor (System.String name, Unity.Entities.WorldFlags flags) (at Library/PackageCache/com.unity.entities@0.14.0-preview.19/Unity.Entities/World.cs:472)
    Unity.Entities.DefaultWorldInitialization.Initialize (System.String defaultWorldName, System.Boolean editorWorld) (at Library/PackageCache/com.unity.entities@0.14.0-preview.19/Unity.Entities/DefaultWorldInitialization.cs:127)
    Unity.Entities.AutomaticWorldBootstrap.Initialize () (at Library/PackageCache/com.unity.entities@0.14.0-preview.19/Unity.Entities.Hybrid/Injection/AutomaticWorldBootstrap.cs:15)
     
  7. msfredb7

    msfredb7

    Joined:
    Nov 1, 2012
    Posts:
    143
    Anybody getting this error in 2023 (I upgraded from burst 1.8.7 to 1.8.8)? Restarting the editor did not fix the issue.

    EDIT: Found a fix that worked for me: Close the editor. Delete the Project > Library > BurstCache folder. Reopen the editor.
     
    Last edited: Sep 14, 2023