Creating an Nx Witness VMS plugin with the latest ONNX Runtime causes repeated abnormal restarts.
AnsweredI'm trying to create a plugin for Nx Witness VMS that uses ONNX Runtime internally, but if I set the ONNX Runtime version above a certain level, the Nx Witness VMS server keeps restarting.
I modified the code from Step 1 of the official tutorial to match the latest Server Plugin SDK version, ensuring it calls only one ONNX Runtime function. The edited source code is as follows:
https://gitlab.com/bluerayi/nx-ort-test
Here, we assume ONNX Runtime version 1.15.1 was selected. Download the prebuilt files for ONNX Runtime 1.15.1 from the ONNX Runtime official repository Releases page, extract them, and specify their path (Line 14 of CMakeLists.txt). Build the plugin, place the built DLL and the ONNX Runtime DLL in the Nx Witness VMS plugin directory, and start the server. It will launch without issues, and you can enable the plugin.
However, when performing the same steps using the current latest version 1.24.1, the server crashes immediately after startup and then repeatedly restarts. The server log (main.log) only shows startup logs immediately after attempting to load the relevant plugin, making it impossible to extract detailed information.
My environment is as follows:
| Item | Value |
| ------------------ | ---------------------------------------------- |
| Operating System | Windows 11 Pro x64 25H2 |
| Nx Witness VMS | v6.0.1.39873 |
| Server Plugin SDK | v6.1.0.42176 |
| Compiler | cl v19.44.35222 (Visual Studio 2022 v17.14.26) |
| CMake | v4.2.3 |
| Built ONNX Runtime | onnxruntime-win-x64-X.XX.X.zip |-
Hello,
There are several general notes to draw your attention to before going into code details.
- Your SDK and Server version differ. That might cause failures if your plugin used SDK features the Server doesn't support.
- The latest version supported is MSVC Build Tools and compiler 14.38. Newer versions can cause failures. It's not mentioned in the readme.md yet. We're going to update it soon.
- place plugin binary and its dependent binaries in a separate directory as described here https://meta.nxvms.com/docs/developers/knowledgebase/235-step-3-adding-object-detection in the "Organizing third-party library files" section.
Try to remove code
m_ortEnv = std::make_unique<Ort::Env>( OrtLoggingLevel::ORT_LOGGING_LEVEL_ERROR, "Foobar" );out of the DeviceAgent class constructor. It would be easier to debug it.
Having taken a look at your cmake file, I guess the issues might be caused linking wrong .lib files.
The line links libraries statically to the resulting binary
target_link_libraries(opencv_object_detection_analytics_plugin nx_kit nx_sdk ${deps})meanwhile above in the file
set(deps ${deps} ${onnxRuntimeDir}/lib/onnxruntime_providers_shared.lib)makes me think the .lib is shared, i.e. a one to be linked dynamically.
I guess, in the version 1.24.1 implied linking type might be different from the one you expect.
0
Please sign in to leave a comment.
Comments
1 comment