I’m developing a windows service that starts live streams triggered by rules in mgmt client. CPU usage is increasing over time until it reaches 100%.
With cpu at 18% (after running for a few days) procdump showed that 835 of 844 threads are leaked JPEGLiveSource poll threads — all with the identical signature:
There are some cameras with poor 4G connections so I guess that is the cause of the failed connection, but is there a way to make it timeout instead of hang forever?
Please let me know the version of the MIP SDK (NuGet) you are using, and the XProtect VMS version.
If you are using an older version of the MIP SDK please try building with and using the newest version.
BaseLiveSource (the base class) sets a timeout of -1, which is infinity and could end up in the situation you describe. Please try:
var source = new JPEGLiveSource(item)
{
ConnectTimeout = TimeSpan.FromSeconds(15) // or whatever makes sense in the specific case
};
source.LiveContentEvent += OnFrame;
source.Init();
Great! I checked this morning and cpu was on 0% after running for a week so it seems the sdk update helped, but I will set a timeout too as an extra safeguard.