Race condition in ContactManager often crashes contacts in the editor
available in future release
SenkyDragon
If a contact is enabled in the editor play mode while contacts are being processed in their background thread, the addition of that contact crashes with the following stack trace, and fails to process from that point on. This issue is new in VRCSDK 3.7.3 and still exists in 3.7.4.
InvalidOperationException: The previously scheduled job ContactManager:UpdateReceivers writes to the Unity.Collections.NativeArray`1[VRC.Dynamics.ContactManager+ReceiverData] UpdateReceivers.receivers. You must call JobHandle.Complete() on the job ContactManager:UpdateReceivers, before you can read from the Unity.Collections.NativeArray`1[VRC.Dynamics.ContactManager+ReceiverData] safely.
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0)
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0)
Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0)
Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0)
VRC.Dynamics.ContactManager.FindAvailableId () (at <18f19c27e14b4ae6a2e430e7e9917e85>:0)
VRC.Dynamics.ContactManager.AddContact (VRC.Dynamics.ContactBase contact) (at <18f19c27e14b4ae6a2e430e7e9917e85>:0)
VRC.Dynamics.ContactBase.Start () (at <18f19c27e14b4ae6a2e430e7e9917e85>:0)
VRC.Dynamics.ContactReceiver.Start () (at <18f19c27e14b4ae6a2e430e7e9917e85>:0)
And then every frame after that (because the contact was not added to the manager properly):
IndexOutOfRangeException: Index 65535 is out of range of '4096' Length.
Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0)
Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0)
Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0)
VRC.Dynamics.ContactReceiver.UpdateContact () (at <18f19c27e14b4ae6a2e430e7e9917e85>:0)
VRC.Dynamics.ContactManager.HandleDynamicsFrameComplete () (at <18f19c27e14b4ae6a2e430e7e9917e85>:0)
VRC.Dynamics.VRCAvatarDynamicsScheduler.FinalizeJob (System.Boolean force) (at <18f19c27e14b4ae6a2e430e7e9917e85>:0)
VRC.Dynamics.VRCAvatarDynamicsScheduler.OnCameraPreCull (UnityEngine.Camera cam) (at <18f19c27e14b4ae6a2e430e7e9917e85>:0)
UnityEngine.Camera.FireOnPreCull (UnityEngine.Camera cam) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0)
Log In
This post was marked as
available in future release
Dexvoid
tracked
SenkyDragon
This is fixed using reflection in the latest release of VRCFury by calling VRCAvatarDynamicsScheduler._currentDynamicsJobHandle.Complete() before any call to ContactManager.AddContact or ContactManager.RemoveContact.