IExporter exporter = new MKVExporter { Filename = path};
exporter.Path = path;
exporter.Init();
exporter.CameraList = new List<VideoOS.Platform.Item>() { camera };
if (exporter.StartExport(from.ToUniversalTime(), to.ToUniversalTime()))
{
while (exporter.Progress < 100)
{
Thread.Sleep(50);
if (exporter.LastError > 0)
{
eventLog.WriteEntry(exporter.LastErrorString);
}
}
The exports are triggered by alarms like this:
_msgObj1 = _messageCommunication.RegisterCommunicationFilter(NewAlarmMsgReciever, new CommunicationIdFilter(MessageId.Server.NewAlarmIndication), null, EndPointType.Server);
This has worked fine for a while, but now it has started to log “Unable to connect to toolkit!” lots of times for every exported file. The files get exported eventually, but why does this error appear?
I read that this message could be caused by failure to connect to recording server, but it doesn’t seem overloaded or anything. The network and disk utilization is very low. Could there be problems if more than one camera tries to export at the same time?
This is happening on a system I don’t have access to personally, and I haven’t been able to reproduce it myself. Before they could export from ExportSample or Smart Client, they rebooted the system which fixed it, at least for now. Previously they had tried restarting the Milestone services (Management/Recording/Event servers) and also our own service which runs the above code, but none of this helped.
“Unable to connect to toolkit!” is a message that means the exporter cannot get camera data, unfortunately there are many root causes and it can be difficult or sometimes impossible to find the root cause for an incidence.
I got some more observations/clarifications and questions.
There are several cameras configured as alarm sources, but the error only happens for a specific camera, and not for every alarm but only once in a while. But once it happens, the exporter thread gets stuck in a loop for days, spamming the logs with the toolkit error at 0% export progress.
What’s really weird is that when the error happens, the alarm timestamp from Alarm.EventHeader.Timestamp is from several minutes into the future compared to the log entry timestamp. Also, one of the times when the export was successfull, the alarm timestamp was from over 10 seconds before the service got notified of it, but maybe that’s completely unrelated. Most of the time there is a discrepancy of just a fraction of a second as would be expected.
Why would the alarm timestamp behave this way, and just for a specific camera? And how could that be related to not being able to connect to the rec server?
When you export video, you need to use correct timestamp. If you use future timestamp then it will fail for sure because future timestamp is not correct for exporting.
The issue seems now to be that you get a wrong timestamp in the step before doing the export. I suggest you ask a new question on this forum, where you explain how you get a wrong timestamp and ask for ideas on how to troubleshoot or debug that situation.