Unity-Technologies / Unity-Technologies/sentis-samples

Bug: Null Reference in Unity Inference Engine code

Open
#25 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
358
Forks
73
PR merge metrics
No merged PRs in 30d

Description

I get a null reference deep in the bowels of the code sporadically when I try to use this in a stress test. Error is below. I tested with both BackendType.CPU and BackendType.GPUCompute for the Workers. Seems to be an issue with:
./Library/PackageCache/com.unity.ai.inference@89644c5bfb09/Runtime/Core/TensorGeneric.cs:157

Sample that tests a sequence of images, videos and webcam by cycling through these is here: Dr. Crawfis' BlazePose Refactor for Unity

----------------Null Reference--------------
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Awaitable1[T].SetResultAndRaiseContinuation (T result) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) UnityEngine.Awaitable+AwaitableAsyncMethodBuilder1[T].SetResult (T value) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0)
Unity.InferenceEngine.Tensor1[T].ReadbackAndCloneAsync () (at ./Library/PackageCache/com.unity.ai.inference@89644c5bfb09/Runtime/Core/TensorGeneric.cs:157) UnityEngine.Awaitable+AwaitableAsyncMethodBuilder1+StateMachineBox1[T,TStateMachine].DoMoveNext () (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) UnityEngine.Awaitable.RunOrScheduleContinuation (UnityEngine.Awaitable+AwaiterCompletionThreadAffinity awaiterCompletionThreadAffinity, System.Action continuation) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) UnityEngine.Awaitable.RaiseManagedCompletion () (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) UnityEngine.Awaitable1[T].SetResultAndRaiseContinuation (T result) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0)
UnityEngine.Awaitable+AwaitableAsyncMethodBuilder1[T].SetResult (T value) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) Unity.InferenceEngine.Tensor.ReadbackAndCloneAsync () (at ./Library/PackageCache/com.unity.ai.inference@89644c5bfb09/Runtime/Core/Tensor.cs:187) UnityEngine.Awaitable+AwaitableAsyncMethodBuilder1+StateMachineBox1[T,TStateMachine].DoMoveNext () (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) UnityEngine.Awaitable.RunOrScheduleContinuation (UnityEngine.Awaitable+AwaiterCompletionThreadAffinity awaiterCompletionThreadAffinity, System.Action continuation) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) UnityEngine.Awaitable.RaiseManagedCompletion () (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) UnityEngine.Awaitable1[T].SetResultAndRaiseContinuation (T result) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0)
UnityEngine.Awaitable+AwaitableAsyncMethodBuilder1[T].SetResult (T value) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) Unity.InferenceEngine.ComputeTensorData.DownloadAsync[T] (System.Int32 dstCount) (at ./Library/PackageCache/com.unity.ai.inference@89644c5bfb09/Runtime/Core/Backends/GPUCompute/ComputeTensorData.cs:144) UnityEngine.Awaitable+AwaitableAsyncMethodBuilder1+StateMachineBox1[T,TStateMachine].DoMoveNext () (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) UnityEngine.Awaitable.RunOrScheduleContinuation (UnityEngine.Awaitable+AwaiterCompletionThreadAffinity awaiterCompletionThreadAffinity, System.Action continuation) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) UnityEngine.Awaitable.RaiseManagedCompletion () (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0) UnityEngine.Awaitable1[T].SetResultAndRaiseContinuation (T result) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0)
UnityEngine.Rendering.AsyncGPUReadbackRequest.InvokeCallback (System.Action`1[T] callback, UnityEngine.Rendering.AsyncGPUReadbackRequest obj) (at <7fa9e22a6c4a40e5abbae8599fd0bce3>:0)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the stress sequence from the linked BlazePose Refactor for Unity sample using both BackendType.CPU and BackendType.GPUCompute. Inspect Runtime/Core/TensorGeneric.cs:157, Runtime/Core/Tensor.cs:187, and Runtime/Core/Backends/GPUCompute/ComputeTensorData.cs:144 to trace the sporadic null reference; done means the sequence no longer raises the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.