High-frequency thread creation/termination and continuous C++ exceptions in NxLib

General Information

  • Product: C57-6-M, C57-8-L
  • Serial Number: 245046, 258860
  • Ensenso SDK Version: 4.2.1821
  • Operating System: Windows 11
  • Data Attachments?
    • Screenshots

Problem / Question

Hello,

We are developing a Windows application using the Ensenso SDK (NxLib) with Visual Studio 2022 C++. During long-term stability testing, we encountered an issue where our application silently crashes after repeating capture operations over an extended period.

While we are still investigating the root cause, we have observed a suspicious behavior in NxLib immediately after the camera is opened:

  • A high‑frequency cycle of thread creation and termination (log entries such as L_AllocThreadData and L_FreeThreadData).

  • C++ exceptions are continuously thrown from within NxLib64.dll.
    These exceptions appear to be handled internally, but they are visible when a debugger is attached.

We have confirmed that the same behavior occurs not only in our own application, but also in the provided nxSimple sample program. By adding an idle period after the camera open command and attaching a debugger, we can observe it.

Is this repeated thread creation/termination and continuous internal exception throwing an expected behavior of NxLib?

Hi @yanofumiya.

The NxLib creates and terminates a lot of threads during normal operation and catches thrown exceptions internally. We strive to reduce both over time but for now: your obervations are to be expected and do not necessarily indicate a problem within the NxLib.

  • Have you set up Windows to generate dump files in case of program crashes?
  • Are you catching NxLibException in all places where you use throwing NxLib C++ API functions?
  • Does the process’s memory usage stay bounded during your test?

If you manage to produce a crash dump that places the location of the crash inside NxLib64.dll and are willing to share the dump file with me, I can provide you with an upload link via DM.

If there is anything else I can help you with, please let me know.

Regards,
Raphael

Hi @RSC

We appreciate your feedback.
We will continue our investigation, and if we obtain any additional information regarding NxLib, we will inform you at that time.

Thank you for some advice.
We have also configured crash dumps; however, since this was not a normal crash, no dump file was generated.
NxLib exceptions are being properly caught.
No memory leaks or similar issues have been observed, and the system appears to be stable.