NvMOT_Query fails with "Context handle is NULL" when called directly from C++ (DeepStream 7.1, Jetson Orin)

Hardware Platform: Jetson Orin (aarch64) DeepStream Version: 7.1.0 JetPack Version: R36.4.7 TensorRT Version: 10.3.0.30 NVIDIA GPU Driver Version: 540.4.0 Issue Type: Question / Bug


Issue Description:

When calling NvMOT_Query directly from C++ without a GStreamer pipeline, the library immediately prints:

NvMOT_Query failed. Context handle is NULL.

and returns NvMOTStatus = 1.

What has been verified:

  • Config file path is a correct absolute path, file exists, YAML format is valid

  • ldd confirms all dependent .so libraries resolve correctly (no “not found”)

  • NvMOT_Query symbol exists in libnvds_nvmultiobjecttracker.so

  • Config file follows the official config_tracker_NvDCF_max_perf.yml format exactly

Code to reproduce:

cpp

NvMOTQuery query;
std::memset(&query, 0, sizeof(query));

NvMOTStatus status = NvMOT_Query(
    static_cast<uint16_t>(config_path_.length()),
    const_cast<char*>(config_path_.c_str()),
    &query
);
// Library prints: "NvMOT_Query failed. Context handle is NULL."
// status = 1 (NvMOTStatus_Error)

Config file used (config_tracker_NvDCF_max_perf.yml format):

yaml

%YAML:1.0
BaseConfig:
  minDetectorConfidence: 0.2
TargetManagement:
  maxTargetsPerStream: 100
  probationAge: 3
  maxShadowTrackingAge: 10
  earlyTerminationAge: 1
...
VisualTracker:
  visualTrackerType: 1

Question:

  1. Is calling NvMOT_Query directly from C++ supported without a GStreamer pipeline?

  2. Is there any required initialization step before calling NvMOT_Query?

  3. Does NvMOT_Query require a valid context handle to already exist before it can be called?

  1. Calling NvMOT_Query() directly from C++ is possible, but for libnvds_nvmultiobjecttracker.so it is not enough to call it with a zero-initialized NvMOTQuery.
  2. Yes. For this implementation, you need to create a tracker context first with NvMOT_Init().
  3. Yes. The current NvMultiObjectTracker implementation expects pQuery->contextHandle to be valid before NvMOT_Query() is called. nvtracker plugin is opensourced. Plese check how NvMOT_Query is usd in /opt/nvidia/deepstream/deepstream/sources/gst-plugins/gst-nvtracker/. Or, please refer to a working sample. test.zip (1.5 KB).

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks.