Repository navigation
Description
Describe the bug
In NvTrackerProc::processBatch() and processSubBatch(), miscDataResult is declared without initialisation (nvtracker_proc.cpp#L2512, #L2902). When m_MiscDataMgr.pop() returns no buffer, the else branch resets pPastFrameObjBatch, pTerminatedTrackBatch and pReidTensorBatch, but not pShadowTrackBatch (#L2527-L2531, #L2910-L2914):
NvMOTTrackerMiscData miscDataResult; // not initialised
if (pMiscDataBuf) { /* all pointers set */ }
else
{
miscDataResult.pPastFrameObjBatch = nullptr;
procResult.pReidTensorBatch = nullptr;
miscDataResult.pTerminatedTrackBatch = nullptr;
// pShadowTrackBatch keeps whatever was on the stack
}The tracker library then treats any non-null pointer as valid and writes shadow-track output through it (context.cpp#L280):
if(pTrackerMiscData && pTrackerMiscData->pShadowTrackBatch)
m_pLocalizer->outputShadowObj(videoStreamIdList, pTrackerMiscData->pShadowTrackBatch);The result is a write through an indeterminate pointer: silent memory corruption or a crash far from the cause.
The "Unable to acquire a user meta buffer" warning is only printed when pastFrame or outputReidTensor is on, so with only shadow-track output enabled, pool exhaustion is not logged at all.
Related, smaller: TrackerMiscDataManager never sets numAllocated on the per-target past-frame and shadow-track lists (miscdatabufmanager.cpp#L109, #L297); terminated-track lists do set it (#L216-L217). The library does not read it today, but the field is public in NvDsTargetMiscDataObject, so applications reading this metadata get an indeterminate capacity.
Steps/Code to reproduce bug
Found by code review; no deterministic reproduction, because the outcome depends on stack contents. The path is reached by any nvtracker pipeline with shadow-track output enabled (TargetManagement.outputShadowTracks: 1) and a user meta pool that runs empty, e.g. user-meta-pool-size=1 (default 32) with a slow downstream that holds the user meta. A debug build of the plugin under valgrind (--track-origins=yes) or MemorySanitizer should then report the uninitialised pShadowTrackBatch.
Expected behavior
When no misc data buffer is available, every output pointer passed to the library is nullptr.
Fix is on my fork:
- Branch: https://github.com/TheGoncaloSilva/DeepStream/tree/fix-nvtracker-miscdata-init (based on
develop3091168) - Commit: TheGoncaloSilva@bf1618a (DCO signed off)
Summary of the change:
- NvMOTTrackerMiscData miscDataResult;
+ NvMOTTrackerMiscData miscDataResult = {};
...
miscDataResult.pTerminatedTrackBatch = nullptr;
+ miscDataResult.pShadowTrackBatch = nullptr;(in both processBatch() and processSubBatch()), plus objList.numAllocated = maxShadowTrackingAge; / = 1; in allocatePastFrame() / allocateShadowTracks().
Environment details (please complete the following information):
- Environment location: Docker on bare-metal Jetson Orin, JetPack 6.2 (L4T R36.4.7)
- Method of DeepStream install: Docker (
nvcr.io/nvidia/deepstream:7.1-triton-multiarch) scripts/print_env.sh: not run. Found by reading the DeepStream 7.1 SDK sources (sources/gst-plugins/gst-nvtracker/nvtracker_proc.cpp); the same code is ondevelop(3091168).
Activity
gst-nvtracker: initialise misc data pointers when the user meta pool …
kevinsongbing commentedon Nov 17, 2026
Seems reasonable, we will check and feedback later.
kevinsongbing commentedon Nov 18, 2026
Please submit PR based on the guide: https://github.com/NVIDIA/DeepStream/blob/main/PULL_REQUEST_GUIDELINES.md . Are you meet this issue in your real use case?
fix(nvtracker): initialise misc data pointers when the user meta pool…
TheGoncaloSilva commentedon Nov 18, 2026
Not in practice. We found it while tracking down the heap corruption in #121, which turned out to be the real cause of our crashes. We run with shadow-track output enabled and the default user meta pool size, and have never seen the pool run empty, so we have never hit this path.
It's a small, low-risk fix, but I understand if it gets lower priority. As with #121, I can't open a pull request, since i'm not a collaborator. The branch is rebased on the current
develop(dfcc4e7), with a Conventional Commit and sign-off: