Search Issue Tracker

Fixed in 2022.1.X

Planned for 2019.4.X, 2020.3.X, 2021.3.X

Votes

8

Found in

2019.4

2020.3

2020.3.12f1

2021.1

2021.2

2022.1

Issue ID

1348778

Regression

No

[InputSystem] QueueStateEvent exceptions when it is being called from another thread

Input

-

Reproduction steps:
1. Open the attached project from the google drive link
2. Go to Assets > Scenes > "SampleScene.unity"
3. Enter Play Mode

Expected result: No error exceptions in the console window
Actual result: Error exceptions in the console window

Reproducible with: 1.0.0-preview.2, 1.0.2, 1.1.0-preview.3 (2019.4.29f1, 2020.3.15f1, 2021.1.16f1), 1.1.0-pre.5 (2021.2.0b5, 2022.1.0a3)

  1. Response avatar

    Resolution Note (fix version 2022.1):

    Fixed in 2022.1.0a15

Comments (1)

  1. B0b96ef346820354f43f6b2e74e20871?d=mm

    massivevr

    Feb 02, 2022 11:59

    Tried in 2022.1.0b5 and now got:

    Assertion failed on expression: 'gCurrentManagedTempMem != NULL'
    UnityEngine.StackTraceUtility:ExtractStackTrace ()
    Unity.Collections.NativeArray`1<byte>:Allocate (int,Unity.Collections.Allocator,Unity.Collections.NativeArray`1<byte>&)
    Unity.Collections.NativeArray`1<byte>:.ctor (int,Unity.Collections.Allocator,Unity.Collections.NativeArrayOptions)
    UnityEngine.InputSystem.InputSystem:QueueStateEvent<MASSIVE.InputSystem.DeviceModules.Shimmer.Shimmer3DeviceState> (UnityEngine.InputSystem.InputDevice,MASSIVE.InputSystem.DeviceModules.Shimmer.Shimmer3DeviceState,double)
    MASSIVE.InputSystem.DeviceModules.Shimmer.ShimmerModule:ProcessData (ShimmerAPI.CustomEventArgs) (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Scripts2/ShimmerModule.cs:488)
    MASSIVE.InputSystem.DeviceModules.Shimmer.ShimmerModule:HandleShimmerEvent (object,System.EventArgs) (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Scripts2/ShimmerModule.cs:224)
    ShimmerAPI.ShimmerBluetooth:OnNewEvent (System.EventArgs) (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Plugins/ShimmerAPI/ShimmerBluetooth.cs:6201)
    ShimmerAPI.ShimmerBluetooth:ReadData () (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Plugins/ShimmerAPI/ShimmerBluetooth.cs:1121)
    System.Threading.ThreadHelper:ThreadStart ()

    and:

    ArgumentException: Could not allocate native memory. If this allocation was made from a managed thread outside of a job, you must use Allocator.Persistent or Allocator.TempJob.
    Unity.Collections.NativeArray`1[T].Allocate (System.Int32 length, Unity.Collections.Allocator allocator, Unity.Collections.NativeArray`1[T]& array) (at <aba06c866efd427898fe6d5a65b8962a>:0)
    Unity.Collections.NativeArray`1[T]..ctor (System.Int32 length, Unity.Collections.Allocator allocator, Unity.Collections.NativeArrayOptions options) (at <aba06c866efd427898fe6d5a65b8962a>:0)
    UnityEngine.InputSystem.LowLevel.InputEventBuffer.AllocateEvent (System.Int32 sizeInBytes, System.Int32 capacityIncrementInBytes, Unity.Collections.Allocator allocator) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/Events/InputEventBuffer.cs:214)
    UnityEngine.InputSystem.LowLevel.InputEventBuffer.AppendEvent (UnityEngine.InputSystem.LowLevel.InputEvent* eventPtr, System.Int32 capacityIncrementInBytes, Unity.Collections.Allocator allocator) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/Events/InputEventBuffer.cs:171)
    UnityEngine.InputSystem.LowLevel.InputEventStream.Write (UnityEngine.InputSystem.LowLevel.InputEvent* eventPtr) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/Events/InputEventStream.cs:99)
    UnityEngine.InputSystem.InputManager.QueueEvent (UnityEngine.InputSystem.LowLevel.InputEvent* eventPtr) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/InputManager.cs:1739)
    UnityEngine.InputSystem.InputManager.QueueEvent[TEvent] (TEvent& inputEvent) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/InputManager.cs:1756)
    UnityEngine.InputSystem.InputSystem.QueueStateEvent[TState] (UnityEngine.InputSystem.InputDevice device, TState state, System.Double time) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/InputSystem.cs:2590)
    MASSIVE.InputSystem.DeviceModules.Shimmer.ShimmerModule.ProcessData (ShimmerAPI.CustomEventArgs args) (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Scripts2/ShimmerModule.cs:488)
    MASSIVE.InputSystem.DeviceModules.Shimmer.ShimmerModule.HandleShimmerEvent (System.Object sender, System.EventArgs args) (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Scripts2/ShimmerModule.cs:224)
    ShimmerAPI.ShimmerBluetooth.OnNewEvent (System.EventArgs e) (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Plugins/ShimmerAPI/ShimmerBluetooth.cs:6201)
    ShimmerAPI.ShimmerBluetooth.ReadData () (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Plugins/ShimmerAPI/ShimmerBluetooth.cs:1121)
    System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <cdc4992cc04a4e77a24a09cd121af77b>:0)
    System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <cdc4992cc04a4e77a24a09cd121af77b>:0)
    System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <cdc4992cc04a4e77a24a09cd121af77b>:0)
    System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <cdc4992cc04a4e77a24a09cd121af77b>:0)
    System.Threading.ThreadHelper.ThreadStart () (at <cdc4992cc04a4e77a24a09cd121af77b>:0)
    UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)
    Unity.Collections.LowLevel.Unsafe.UnsafeUtility:Malloc(Int64, Int32, Allocator)
    Unity.Collections.NativeArray`1:Allocate(Int32, Allocator, NativeArray`1&)
    Unity.Collections.NativeArray`1:.ctor(Int32, Allocator, NativeArrayOptions)
    UnityEngine.InputSystem.InputSystem:QueueStateEvent(InputDevice, Shimmer3DeviceState, Double)
    MASSIVE.InputSystem.DeviceModules.Shimmer.ShimmerModule:ProcessData(CustomEventArgs) (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Scripts2/ShimmerModule.cs:488)
    MASSIVE.InputSystem.DeviceModules.Shimmer.ShimmerModule:HandleShimmerEvent(Object, EventArgs) (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Scripts2/ShimmerModule.cs:224)
    ShimmerAPI.ShimmerBluetooth:OnNewEvent(EventArgs) (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Plugins/ShimmerAPI/ShimmerBluetooth.cs:6201)
    ShimmerAPI.ShimmerBluetooth:ReadData() (at Assets/MASSIVE/InputSystem/Devices/Shimmer/Plugins/ShimmerAPI/ShimmerBluetooth.cs:1121)
    System.Threading.ThreadHelper:ThreadStart()

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.