Strange shared memory problems
-
- Posts: 14
- Joined: Sat Feb 26, 2005 8:45 am
- Location: Cologne/Germany
Strange shared memory problems
Hi all!
I've searched the forum and the README but can't find anything about that. I'm running ZoneMinder v1.22.3 on Ubuntu 6
/etc/sysctl.conf:
kernel.shmall = 134217728
kernel.shmmax = 134217728
I'm wondering about the "No such file or directory" message in the logfiles, look at zmdc.log:
zmdc[4439].INF ['zmc -d /dev/video0' starting at 07/02/05 19:20:14, pid = 4551]
zmdc[4439].INF ['zmc -d /dev/video0' crashed, signal 4]
zmdc[4439].INF ['zmc -d /dev/video0' starting at 07/02/05 19:20:27, pid = 4555]
zmdc[4439].INF ['zmc -d /dev/video0' crashed, signal 4]
My /var/log/syslog says
zmwatch[4471]: ERR [Can't get shared memory id '7a6d2003', 3: No such file or directory]
zmwatch[4471]: INF [Restarting capture daemon for Keller, shared memory not valid]
zmdc[4439]: INF ['zmc -d /dev/video0' starting at 07/02/05 19:26:16, pid = 4785]
zmdc[4785]: INF ['zmc -d /dev/video0' started at 07/02/05 19:26:16]
zmc_dvideo0[4785]: INF [Debug Level = 0, Debug Log = <none>]
zmdc[4439]: INF ['zmc -d /dev/video0' crashed, signal 4]
zmwatch.log:
zmwatch[4471].ERR [Can't get shared memory id '7a6d2003', 3: No such file or directory]
zmwatch[4471].INF [Restarting capture daemon for Keller, shared memory not valid]
zmwatch[4471].INF ['zmc -d /dev/video0' starting at 07/02/05 19:30:13, pid = 4964]
zmwatch[4471].ERR [Can't get shared memory id '7a6d2003', 3: No such file or directory]
zmwatch[4471].INF [Restarting capture daemon for Keller, shared memory not valid]
zmwatch[4471].INF ['zmc -d /dev/video0' starting at 07/02/05 19:30:26, pid = 4970]
Seems ZM can't access the video device. I've tried xawtv and it worked fine on all available 4 channels.
I'm quite lost with that problems because anything seems good when using xawtv. I'm able to access all four ports of the card but not using ZM.
I've searched the forum and the README but can't find anything about that. I'm running ZoneMinder v1.22.3 on Ubuntu 6
/etc/sysctl.conf:
kernel.shmall = 134217728
kernel.shmmax = 134217728
I'm wondering about the "No such file or directory" message in the logfiles, look at zmdc.log:
zmdc[4439].INF ['zmc -d /dev/video0' starting at 07/02/05 19:20:14, pid = 4551]
zmdc[4439].INF ['zmc -d /dev/video0' crashed, signal 4]
zmdc[4439].INF ['zmc -d /dev/video0' starting at 07/02/05 19:20:27, pid = 4555]
zmdc[4439].INF ['zmc -d /dev/video0' crashed, signal 4]
My /var/log/syslog says
zmwatch[4471]: ERR [Can't get shared memory id '7a6d2003', 3: No such file or directory]
zmwatch[4471]: INF [Restarting capture daemon for Keller, shared memory not valid]
zmdc[4439]: INF ['zmc -d /dev/video0' starting at 07/02/05 19:26:16, pid = 4785]
zmdc[4785]: INF ['zmc -d /dev/video0' started at 07/02/05 19:26:16]
zmc_dvideo0[4785]: INF [Debug Level = 0, Debug Log = <none>]
zmdc[4439]: INF ['zmc -d /dev/video0' crashed, signal 4]
zmwatch.log:
zmwatch[4471].ERR [Can't get shared memory id '7a6d2003', 3: No such file or directory]
zmwatch[4471].INF [Restarting capture daemon for Keller, shared memory not valid]
zmwatch[4471].INF ['zmc -d /dev/video0' starting at 07/02/05 19:30:13, pid = 4964]
zmwatch[4471].ERR [Can't get shared memory id '7a6d2003', 3: No such file or directory]
zmwatch[4471].INF [Restarting capture daemon for Keller, shared memory not valid]
zmwatch[4471].INF ['zmc -d /dev/video0' starting at 07/02/05 19:30:26, pid = 4970]
Seems ZM can't access the video device. I've tried xawtv and it worked fine on all available 4 channels.
I'm quite lost with that problems because anything seems good when using xawtv. I'm able to access all four ports of the card but not using ZM.
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
-
- Posts: 14
- Joined: Sat Feb 26, 2005 8:45 am
- Location: Cologne/Germany
More info ...
I've raised logging but the logs don't contain so much more info.
The problem occurs when I call index.php?view=watch, then zmwatch seems to crash.
zmwatch[22427].INF [Restarting capture daemon for Keller, shared memory not valid]
zmwatch[22427].INF ['zmc -d /dev/video0' starting at 07/02/06 05:51:56, pid = 22583]
In zm_debug.log.*
zmu[22504].INF-zm_debug.c/304 [New Debug Level = 9, New Debug Log = /tmp/zm_debug.log.22504]
zmu[22504].DB1-zm_monitor.cpp/1899 [Got 1 monitors]
zmu[22504].ERR-zm_signal.cpp/77 [Got signal (Illegal instruction), crashing]
The "illegal instruction" seems to be new.
I've reviewed messages, syslog, kern and other logfiles for erros but found nothing suspicious.
But when I do a "zmc -d /dev/video0" I get an "Illegal instruction" directly.
I made an "strace -f -vv zmc -d /dev/video0". zmc seems to crash suddenly after accessing some data stored in mysql database but I'm not sure. What I'm wondering is a "Operation not supported" in the strace when trying to connect to mysql socket.
I've uploaded the trace to http://www.skerka.dyndns.org/ZM-strace.txt maybe you see anything in there
The problem occurs when I call index.php?view=watch, then zmwatch seems to crash.
zmwatch[22427].INF [Restarting capture daemon for Keller, shared memory not valid]
zmwatch[22427].INF ['zmc -d /dev/video0' starting at 07/02/06 05:51:56, pid = 22583]
In zm_debug.log.*
zmu[22504].INF-zm_debug.c/304 [New Debug Level = 9, New Debug Log = /tmp/zm_debug.log.22504]
zmu[22504].DB1-zm_monitor.cpp/1899 [Got 1 monitors]
zmu[22504].ERR-zm_signal.cpp/77 [Got signal (Illegal instruction), crashing]
The "illegal instruction" seems to be new.
I've reviewed messages, syslog, kern and other logfiles for erros but found nothing suspicious.
But when I do a "zmc -d /dev/video0" I get an "Illegal instruction" directly.
I made an "strace -f -vv zmc -d /dev/video0". zmc seems to crash suddenly after accessing some data stored in mysql database but I'm not sure. What I'm wondering is a "Operation not supported" in the strace when trying to connect to mysql socket.
I've uploaded the trace to http://www.skerka.dyndns.org/ZM-strace.txt maybe you see anything in there
shared memory
I have had multiple problems with shared memory and this is how I solved it.
Do a basic calculation on your capturing
(resolution X-axis) * (resolution Y-axis) * (Color Depth) = (aprox. Pic Size)
example: 640*480*24=7372800 bits ~ 7MB
(aprox. Pic Size) * (Image Buffer Size (frames) from your monitor in ZM) =
(aprox. Size of shared memory per monitor) this is your <kernel.shmall>
(aprox. Size of shared memory per monitor) is the amount then used by Zoneminder for one zmc process, this doubles during Motion Detection because then one zma process uses the same amount off shared memory.
This you can verify by running the linux command top and looking for these processes.
So your <kernel.shmmax> is then (aprox. Size of shared memory per monitor) *2(for zmc and zma) * (nummber of monitors).
But keep in mind that you shouldn't be using more than 2/3 of your actual physical memory for shared memory, because you have additional processes running like http, mysql and when all your physicall memory is used up linux will start swapping, which means disc access, which slows down your box.
Again you can check this with top
Do a basic calculation on your capturing
(resolution X-axis) * (resolution Y-axis) * (Color Depth) = (aprox. Pic Size)
example: 640*480*24=7372800 bits ~ 7MB
(aprox. Pic Size) * (Image Buffer Size (frames) from your monitor in ZM) =
(aprox. Size of shared memory per monitor) this is your <kernel.shmall>
(aprox. Size of shared memory per monitor) is the amount then used by Zoneminder for one zmc process, this doubles during Motion Detection because then one zma process uses the same amount off shared memory.
This you can verify by running the linux command top and looking for these processes.
So your <kernel.shmmax> is then (aprox. Size of shared memory per monitor) *2(for zmc and zma) * (nummber of monitors).
But keep in mind that you shouldn't be using more than 2/3 of your actual physical memory for shared memory, because you have additional processes running like http, mysql and when all your physicall memory is used up linux will start swapping, which means disc access, which slows down your box.
Again you can check this with top
-
- Posts: 14
- Joined: Sat Feb 26, 2005 8:45 am
- Location: Cologne/Germany
Re: shared memory
I'm currently not sure where the problem is. Currently I'm playing around with adjusted shmall and shmmax settings. I tried 384MB for both but that doesn't solve the problem.ma77hias wrote:I have had multiple problems with shared memory and this is how I solved it.
If I start zmc directly it crashes immediately as mentioned above (return code is 132, when I enter echo $? on shell level).
Code: Select all
# ./zmc -d /dev/video0
Illegal instruction
# echo $?
132
... I'm really lost
-
- Posts: 14
- Joined: Sat Feb 26, 2005 8:45 am
- Location: Cologne/Germany
Re: shared memory
I've done further investigation and debugging. zmc crashes whenbonnerchen wrote:... I'm really lost
Code: Select all
n_monitors = Monitor::LoadLocalMonitors( device, monitors, Monitor::CAPTURE );
Code: Select all
int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;


-
- Posts: 14
- Joined: Sat Feb 26, 2005 8:45 am
- Location: Cologne/Germany
Re: shared memory
Shit!bonnerchen wrote:That's it, more infos I'm not able to provide![]()
I've found the problem. I used "-O3 -march=pentium4" optimization. I switched to "-O2" only and it works!
Re: Strange shared memory problems
I was wondering if that might be the case from this error you have. I seen this once before but could not find the relevant thread here on the forum.bonnerchen wrote: zmdc[4439].INF ['zmc -d /dev/video0' crashed, signal 4]
Glad you got it sorted out.
-
- Posts: 14
- Joined: Sat Feb 26, 2005 8:45 am
- Location: Cologne/Germany
Solved: (Strange shared memory problems)
Sometimes my brain goes crazy. The problem wasn't the "-O3" but the "-march=pentium4" ... the system ZM runs on is only a pentium 3cordel wrote:Glad you got it sorted out.

So everything makes sense, "Illegal instruction" seems to come from a specific P4 command not present on the "old" P3 system I've used for ZM tests. ZM works fine with defauld shared memory kernel settings so now I can switch to the P4 system with P4 optimization.