Periodic restarts of ZM required?

Forum for questions and support relating to the 1.30.x releases only.
Locked
AndyMac
Posts: 18
Joined: Thu Sep 15, 2016 11:55 pm

Periodic restarts of ZM required?

Post by AndyMac »

I've got a single camera hooked up while I evaluate ZM right now. It's an amcrest qcam. What I've noticed is that every week or so, zoneminder simply loses the video stream of the camera. I'm not sure why, but restarting zoneminder gets the stream back. I don't have the camera set to reboot or anything else.

I get errors along the lines of:
Terminating, last frame sent time 1478642532.700031 secs more than maximum of 10.000000
socket_sendto( /tmp/zm/zms-630571s.sock ) failed: No such file or directory
getStreamCmdResponse stream error: socket_sendto( /tmp/zm/zms-630571s.sock ) failed: No such file or directory - checkStreamForErrors()

Those three seem to repeat twenty seconds or so when I log in to look at the camera. I'll have to wait for it to fail again to capture better logs, but wondered if anyone ran into a similar issue and how they fixed it.

If it's useful, I'm using libvlc on the camera, max FPS of 10, rtp/rtsp for the method.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Periodic restarts of ZM required?

Post by bbunge »

switch to ffmpeg
AndyMac
Posts: 18
Joined: Thu Sep 15, 2016 11:55 pm

Re: Periodic restarts of ZM required?

Post by AndyMac »

On this topic, I was told by the forum to use libvlc because of the huge amount of smearing I was getting with ffmpeg:
viewtopic.php?f=36&t=25314

I tried the various workarounds for ffmpeg (buffer size, tx/rx sizes on the server, rtp/rtsp, etc) and couldn't get it to be better than smearing every couple minutes (generating alarms all the time and obviously not recording good images during those times).

So ffmpeg doesn't seem to be a good answer, but do you have reason to suspect it's libvlc that's losing the camera?
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Re: Periodic restarts of ZM required?

Post by haus »

OP, I'm already using ffmpeg and I have the same issue. I can access the camera directly in Firefox when Zoneminder can't see it. When I try to view the stream in ZM I get:

getStreamCmdResponse stream error: socket_sendto( /var/run/zm/zms-155531s.sock ) failed: No such file or directory - checkStreamForErrors()] at ?view=watch line

There's something weird going on when ZM starts/stops and I've only used the web console to do so...so I'm not sure what the problem is.

I was able to fix the smearing issue by lowering the bit rate on the cameras. Also one of my cams in ZM was set to the wrong resolution and that seemed to cause a cascading smearing issue with others as well, so make sure everything matches up.
AndyMac
Posts: 18
Joined: Thu Sep 15, 2016 11:55 pm

Re: Periodic restarts of ZM required?

Post by AndyMac »

Haus, I'm curious what resolution / bit rate / frame rate you're using on the cameras. I'm going for full 1080 resolution because it's a large space I'm covering (outdoor and garage), but I've lowered the frame rate to 5 frames per second. Everything there matches up now, but I still get smearing every five minutes or so if I use ffmpeg. Nothing I've done has fixed that at this resolution. If it's a buffering problem / packet size per image problem as some people suspect, there may simply be nothing to do at a resolution of this size. Unfortunately, smearing that lasts a few frames is not acceptable in my scenario since I want it as an actual security camera system ... those could be the couple frames that the person walks through that zone. So unless I can /fully/ fix the smearing, ffmpeg won't work anyway.

That's unfortunate, because ffmpeg uses a /lot/ less cpu than libvlc seems to, so I'd definitely prefer it.

Even so, it's good to know that even if the smearing was fixed, you have a similar problem with ZM dropping the camera.

I haven't figured out the period of time between camera dropouts, but if it's always longer than, say, a week, I can just do a weekly restart of the zoneminder service. Otherwise, I can also potentially write a script to scan the logs occasionally and if it sees these errors, prompt a zoneminder restart.

But I'm still hoping there's a general solution so I don't have to go around restarting the service all the time.
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Re: Periodic restarts of ZM required?

Post by haus »

I'm using 1280x720, 4fps (limited at the camera, with 6fps at ZM in case of network issues to prevent ZM going crazy), and bit rate 512kbps. I tried bumping that to 1024kbps to see if that would help with the cameras dropping from ZM, but it doesn't make a difference. I haven't tried 1080 because my system is somewhat CPU/RAM limited and I like to keep my non-alarm state load under 0.5.

I like the script monitor idea, that's something I'd consider here too, if not a fully automated restart, at least a warning system that the various ZM components are encountering difficulty would be good to know.
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Re: Periodic restarts of ZM required?

Post by haus »

My issue may be unique. I've noticed that /dev/shm is filling up and I'm not sure why. The zm.mmap files get removed and recreated when I change run states, so ZM seems to be handling them OK, but something else is going on with my system. Anyway, next time you lose a camera check your /dev/shm and see if it's got room. When I do "df -h" after while my /dev/shm is 100% full until I reboot.
AndyMac
Posts: 18
Joined: Thu Sep 15, 2016 11:55 pm

Re: Periodic restarts of ZM required?

Post by AndyMac »

Good catch. I'll have to take a look at that. Currently mine (which is just a softlink to /run/shm) is at 693MB in both ls and df, but it has 7.7GB total (since I have 16GB of ram in this box). I'll watch to see if that grows over time or is maxed out when I lose a camera. Could be that something in ZM either is filling up /run/shm or needs /run/shm and breaks when it's full.

http://askubuntu.com/questions/169495/w ... m-used-for
AndyMac
Posts: 18
Joined: Thu Sep 15, 2016 11:55 pm

Re: Periodic restarts of ZM required?

Post by AndyMac »

Well, I connected a second camera (a foscam c1), and it apparently worked for all of two days before it dropped out and started throwing similar errors to above and not showing any camera feed (even though the direct feed works fine):
getStreamCmdResponse stream error: socket_sendto( /tmp/zm/zms-308423s.sock ) failed: No such file or directory - checkStreamForErrors()
Terminating, last frame sent time 1479186495.143176 secs more than maximum of 10.000000
socket_sendto( /tmp/zm/zms-308423s.sock ) failed: No such file or directory

I looked at /run/shm and no problem there (no problem on any disk or memory space at all).

I'm at a loss. Anyone have any ideas why ZM loses cameras and starts getting these kinds of errors? It's not very useful as an actual security camera system if it drops cameras without notice (or you have to monitor your monitoring software).
Locked