ONVIF PullPoint connection timeouts

Current Development version likely to have breaking changes
Post Reply
pygr
Posts: 48
Joined: Fri Apr 21, 2023 11:49 pm

ONVIF PullPoint connection timeouts

Post by pygr »

With my setup ZoneMinder would function as expected for a number of ONVIF timeout periods, but then would stop recording on ONVIF alarms.

Proposed fix: Build ZoneMinder with tev__PullMessages.Timeout in src/zm_monitor.cpp that is compatible with soap->connect_timeout, and soap->recv_timeout:

Code: Select all

	tev__PullMessages.Timeout = "PT60S"
	soap->connect_timeout = 62;
	soap->recv_timeout = 62;
	soap->send_timeout = 62;
Explanation: The source (as of today) has

Code: Select all

tev__PullMessages.Timeout = "PT600S";
and

Code: Select all

        soap->connect_timeout = 5;
        soap->recv_timeout = 5;
        soap->send_timeout = 5;
So here is my understanding: Zoneminder establishes a TCP connection and tells the camera to maintain the connection until the camera sends a response or the 10 minute timeout occurs, which ever comes first. The soap settings shut down connections after 5 seconds. The problem is that my camera doesn't respond well to ZoneMinder closing the connection after 5 seconds when a response is pending. A tshark view of one of these connections (10.137.113.143 is the camera and 10.137.113.133 is ZoneMinder):

Code: Select all

No.	Time	Source	Destination	Protocol	Length	Info
763	18:05:13.373368643	10.137.113.133	10.137.113.143	TCP	74	45412 → 80 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM TSval=8203415 TSecr=0 WS=2
764	18:05:13.374126578	10.137.113.143	10.137.113.133	TCP	66	80 → 45412 [SYN, ACK] Seq=0 Ack=1 Win=14600 Len=0 MSS=1460 SACK_PERM WS=32
765	18:05:13.374178079	10.137.113.133	10.137.113.143	TCP	54	45412 → 80 [ACK] Seq=1 Ack=1 Win=29200 Len=0
766	18:05:13.374316624	10.137.113.133	10.137.113.143	TCP	1514	45412 → 80 [ACK] Seq=1 Ack=1 Win=29200 Len=1460 [TCP segment of a reassembled PDU]
767	18:05:13.374322999	10.137.113.133	10.137.113.143	HTTP/XML	958	POST /onvif/device_service?Idx=2 HTTP/1.1 
768	18:05:13.375184896	10.137.113.143	10.137.113.133	TCP	60	80 → 45412 [ACK] Seq=1 Ack=1461 Win=17536 Len=0
769	18:05:13.375186896	10.137.113.143	10.137.113.133	TCP	60	80 → 45412 [ACK] Seq=1 Ack=2365 Win=20448 Len=0
793	18:05:18.379521006	10.137.113.133	10.137.113.143	TCP	54	45412 → 80 [FIN, ACK] Seq=2365 Ack=1 Win=29200 Len=0
801	18:05:18.413140999	10.137.113.143	10.137.113.133	TCP	60	80 → 45412 [ACK] Seq=1 Ack=2366 Win=20448 Len=0
2169	18:15:13.420120569	10.137.113.143	10.137.113.133	TCP	289	80 → 45412 [PSH, ACK] Seq=1 Ack=2366 Win=20448 Len=235 [TCP segment of a reassembled PDU]
2170	18:15:13.420162362	10.137.113.133	10.137.113.143	TCP	54	45412 → 80 [RST] Seq=2366 Win=0 Len=0
The camera can tolerate only so many actions like this before some internal resources are used up and it sends back error responses. The solution I tried was to set the PullMessages timeout shorter than the soap timeouts. This solution has worked for a couple of days now. Previously, ZoneMinder would only run about an hour before it stopped triggering on ONVIF alarms.

Does this make sense

pygr
Post Reply