IP Cameras Randomly Disconnect

Forum for questions and support relating to the 1.28.x releases only.
Locked
tonydotigr
Posts: 15
Joined: Sun Aug 31, 2014 6:03 pm

IP Cameras Randomly Disconnect

Post by tonydotigr »

Recently added another IP camera to my setup. Now have 4 IP cameras and two USB. Since adding the latest IP camera been experiencing random disconnects of a camera or two, notice it in the console (device turns red).

Below is the log when camera disconnects.

2015-06-05 07:55:48.823120 zmdc 2504 ERR 'zmc -m 2' exited abnormally, exit status 255 zmdc.pl
2015-06-05 07:55:48.779135 zmc_m2 5205 INF Terminating Logger zm_logger.cpp 238
2015-06-05 07:55:48.663582 zmc_m2 5205 ERR Failed to pre-capture monitor 2 100979956 (1/1) zmc.cpp 277
2015-06-05 07:55:48.630395 zmc_m2 5205 ERR Unable to connect to camera zm_remote_camera_http.cpp 1162
2015-06-05 07:55:48.531002 zmc_m2 5205 ERR Unable to connect to the remote camera, aborting zm_remote_camera_http.cpp 115

The system currently has 8GB of memory and I've increased the shared memory, but I noticed the total shared memory below is still the same?

Code: Select all

john@server: ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 655360
max total shared memory (kbytes) = 134217728
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

------ Messages Limits --------
max queues system wide = 15712
max size of message (bytes) = 8192
default max size of queue (bytes) = 16384

Is there anything else I can try? I've seen recompiling with '--enable--mmap=yes ' might help? Worried about saving the current configuration, etc. Really don't want to lose everything if there's something else I can try or do.

Any help would be appreciated.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: IP Cameras Randomly Disconnect

Post by asker »

I assume you are on 1.28 or above (as this is the forum for that version)
If so, take a look at http://www.zoneminder.com/wiki/index.ph ... o_optimize --> the last section on how to increase mapped memory (you have increased shared memory which is not the same)
tonydotigr wrote:Recently added another IP camera to my setup. Now have 4 IP cameras and two USB. Since adding the latest IP camera been experiencing random disconnects of a camera or two, notice it in the console (device turns red).

Below is the log when camera disconnects.

2015-06-05 07:55:48.823120 zmdc 2504 ERR 'zmc -m 2' exited abnormally, exit status 255 zmdc.pl
2015-06-05 07:55:48.779135 zmc_m2 5205 INF Terminating Logger zm_logger.cpp 238
2015-06-05 07:55:48.663582 zmc_m2 5205 ERR Failed to pre-capture monitor 2 100979956 (1/1) zmc.cpp 277
2015-06-05 07:55:48.630395 zmc_m2 5205 ERR Unable to connect to camera zm_remote_camera_http.cpp 1162
2015-06-05 07:55:48.531002 zmc_m2 5205 ERR Unable to connect to the remote camera, aborting zm_remote_camera_http.cpp 115

The system currently has 8GB of memory and I've increased the shared memory, but I noticed the total shared memory below is still the same?

Code: Select all

john@server: ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 655360
max total shared memory (kbytes) = 134217728
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

------ Messages Limits --------
max queues system wide = 15712
max size of message (bytes) = 8192
default max size of queue (bytes) = 16384

Is there anything else I can try? I've seen recompiling with '--enable--mmap=yes ' might help? Worried about saving the current configuration, etc. Really don't want to lose everything if there's something else I can try or do.

Any help would be appreciated.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
bbunge
Posts: 2934
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: IP Cameras Randomly Disconnect

Post by bbunge »

What OS are you using?

What connection method do you use for your IP cameras?

Try turning down the frame rate and resolution. For the USB cameras do it in the ZM settings. For your IP cameras change the settings at the camera. Also set your resolution down to 320x240 or whatever the lowest you can use. If everything works OK try pushing the resolution up.

With only four cameras you likely will not have an issue with MySQL but you could run mysqltuner just to be sure.

Yes, you should have compiled with the mmap option. I use Ubuntu 14.04 with 16 GIG of ram running 16 IP cameras. I have used just 8 gig and had no problems with the 16 cameras. The 16 GIG allows me to push some operations to RAM disk and not use drive tmp space.

bb
tonydotigr
Posts: 15
Joined: Sun Aug 31, 2014 6:03 pm

Re: IP Cameras Randomly Disconnect

Post by tonydotigr »

Here's little more info...

ZoneMinder version 1.28.1

Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty

Cameras
3x IP 1280x960 24-bit color (using http) - Frame rate 5
1x IP 640x480 24-bit color (using http) - Frame rate 5
2x USB 320x240 (connected directly to server, no problems with these) - Frame rate 4

free -m
total used free shared buffers cached
Mem: 7859 2348 5510 607 165 1161
-/+ buffers/cache: 1021 6837
Swap: 3964 0 3964

df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 913G 38G 829G 5% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 3.8G 4.0K 3.8G 1% /dev
tmpfs 786M 1.9M 785M 1% /run
none 5.0M 0 5.0M 0% /run/lock
tmpfs 5.4G 594M 4.8G 11% /run/shm
none 100M 48K 100M 1% /run/user

ls -lah /run/shm
total 594M
drwxrwxrwt 2 root root 240 Jun 6 08:50 .
drwxr-xr-x 31 root root 980 Jun 6 08:52 ..
-rwx------ 1 lightdm lightdm 65M Jun 6 08:50 pulse-shm-2089058894
-rwx------ 1 lightdm lightdm 65M Jun 6 08:50 pulse-shm-229167794
-rwx------ 1 lightdm lightdm 65M Jun 6 08:50 pulse-shm-2744610741
-rw-r--r-- 1 plex plex 32 Jun 6 08:50 sem.9334581e-7251-4ef7-a8ec-5bfe8e89ff68
-rw------- 1 www-data www-data 11M Jun 6 08:50 zm.mmap.1
-rw------- 1 www-data www-data 176M Jun 6 08:50 zm.mmap.2
-rw------- 1 www-data www-data 11M Jun 6 08:50 zm.mmap.3
-rw------- 1 www-data www-data 44M Jun 6 08:50 zm.mmap.4
-rw------- 1 www-data www-data 176M Jun 6 09:39 zm.mmap.6
-rw------- 1 www-data www-data 176M Jun 6 09:00 zm.mmap.7


I added the line below to /etc/fstab and restarted.

Code: Select all

tmpfs /run/shm tmpfs defaults,noexec,nosuid,size=70% 0 0
After running the command below, still only have 593.272M (same as before)

Code: Select all

ls -l /run/shm/zm* | awk 'BEGIN {sum=0} {sum += $5} END {print sum/1024/1024."M"}'
Still getting random disconnects. Think you guys are right about the problem being allocated memory. Seems like the /run/shm is getting limited to 594M, but there's 5.4G allocated.
Last edited by tonydotigr on Sat Jun 06, 2015 7:06 pm, edited 1 time in total.
bencollinz
Posts: 24
Joined: Fri May 29, 2015 12:23 pm

Re: IP Cameras Randomly Disconnect

Post by bencollinz »

tonydotigr wrote:Here's little more info...


I added the line below to /etc/fstab and restarted.

Code: Select all

tmpfs /run/shm tmpfs defaults,noexec,nosuid,size=70% 0 0
After running the command below, still only have 593.272M (same as before)

Code: Select all

ls -l /run/shm/zm* | awk 'BEGIN {sum=0} {sum += $5} END {print sum/1024/1024."M"}'
.
same for me. added that code and still same memory amount as prior to adding it.
bbunge
Posts: 2934
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: IP Cameras Randomly Disconnect

Post by bbunge »

May I recommend you start over and use a packaged version of ZM?

http://www.zoneminder.com/wiki/index.ph ... e_easy_way

About the only change I would make the defaults on Ubuntu is to use the noatime option when you set up the drive space. Using the package from the PPA will take care of any memory issues you may have.

bb
tonydotigr
Posts: 15
Joined: Sun Aug 31, 2014 6:03 pm

Re: IP Cameras Randomly Disconnect

Post by tonydotigr »

Is there anyway to save the configuration of the setup before reinstalling? Dreading the idea of re-configuring all the cameras & filters with the system.
tonydotigr
Posts: 15
Joined: Sun Aug 31, 2014 6:03 pm

Re: IP Cameras Randomly Disconnect

Post by tonydotigr »

After reinstalling I'm still getting random IP camera disconnects.

Is there anyway to verify the PPA installed correctly? Also how would l manually configure some of those settings like NOATIME?
Locked