Local Cam works but remote cam doesn't

Support and queries relating to all previous versions of ZoneMinder
sonic
Posts: 6
Joined: Mon Aug 04, 2003 6:49 pm

Local Cam works but remote cam doesn't

Post by sonic »

I've got Zone Minder up and working with my local camera using a Matrox Marvel G200 to do the capture but I'm having trouble getting remote captures working. I've set up a sample picture on 2 different web servers but according to the web logs nothing is attempting to fetch them. My log output (zmdc.log, messages, syslog) are below. Any idea where I should be looking for the problem?

My zmdc.log says:

Starting pending process, zmc -H homer -P 80 -p /pics/demo2.jpg
'zmc -H homer -P 80 -p /pics/demo2.jpg' starting at 03/08/04 11:54:30, pid = 27320
Starting pending process, zmc -H video1.sonictech.net -P 80 -p /pics/demo1.jpg
'zmc -H video1.sonictech.net -P 80 -p /pics/demo1.jpg' starting at 03/08/04 11:54:30, pid = 27321
'zmc -H homer -P 80 -p /pics/demo2.jpg' started at 03/08/04 11:54:30
'zmc -H video1.sonictech.net -P 80 -p /pics/demo1.jpg' started at 03/08/04 11:54:30
'zmc -H homer -P 80 -p /pics/demo2.jpg' crashed at 03/08/04 11:54:30, exit status 255
'zmc -H video1.sonictech.net -P 80 -p /pics/demo1.jpg' crashed at 03/08/04 11:54:30, exit status 255

Also my /var/log/messages says:

Aug 4 11:54:30 video1 zmc-hhomer[27320]: INF [Debug Level = 0, Debug Log = ]
Aug 4 11:54:30 video1 zmc-hhomer[27320]: INF [Got 1 monitors]
Aug 4 11:54:30 video1 zmc-hhomer[27320]: INF [monitor mode=1]
Aug 4 11:54:30 video1 zmc-hhomer[27320]: INF [shm.size=98304448]
Aug 4 11:54:30 video1 zmc-hvideo1.sonictech.net[27321]: INF [Debug Level = 0, Debug Log = ]
Aug 4 11:54:30 video1 zmc-hvideo1.sonictech.net[27321]: INF [Got 1 monitors]
Aug 4 11:54:30 video1 zmc-hvideo1.sonictech.net[27321]: INF [monitor mode=1]
Aug 4 11:54:30 video1 zmc-hvideo1.sonictech.net[27321]: INF [shm.size=98304448]

And my /var/log/syslog says:

Aug 4 11:54:30 video1 zmc-hhomer[27320]: INF [Debug Level = 0, Debug Log = ]
Aug 4 11:54:30 video1 zmc-hhomer[27320]: INF [Got 1 monitors]
Aug 4 11:54:30 video1 zmc-hhomer[27320]: INF [monitor mode=1]
Aug 4 11:54:30 video1 zmc-hhomer[27320]: INF [shm.size=98304448]
Aug 4 11:54:30 video1 zmc-hhomer[27320]: ERR [Can't shmget: Invalid argument]
Aug 4 11:54:30 video1 zmc-hvideo1.sonictech.net[27321]: INF [Debug Level = 0, Debug Log = ]
Aug 4 11:54:30 video1 zmc-hvideo1.sonictech.net[27321]: INF [Got 1 monitors]
Aug 4 11:54:30 video1 zmc-hvideo1.sonictech.net[27321]: INF [monitor mode=1]
Aug 4 11:54:30 video1 zmc-hvideo1.sonictech.net[27321]: INF [shm.size=98304448]
Aug 4 11:54:30 video1 zmc-hvideo1.sonictech.net[27321]: ERR [Can't shmget: Invalid argument]
Aug 4 11:54:31 video1 zmu[27324]: ERR [Can't shmget: Invalid argument]
Aug 4 11:54:42 video1 zmu[27328]: ERR [Can't shmget: Invalid argument]
Aug 4 11:54:52 video1 zmu[27332]: ERR [Can't shmget: Invalid argument]
Aug 4 11:55:01 video1 /USR/SBIN/CRON[27337]: (root) CMD (/usr/src/vidcap/maven_prog/maven-prog/standard > /tmp/maven 2>&1;)
Aug 4 11:55:02 video1 zmu[27344]: ERR [Can't shmget: Invalid argument]
Aug 4 11:55:12 video1 zmu[27348]: ERR [Can't shmget: Invalid argument]
Aug 4 11:55:22 video1 zmu[27352]: ERR [Can't shmget: Invalid argument]
Aug 4 11:55:33 video1 zmu[27356]: ERR [Can't shmget: Invalid argument]
sonic
Posts: 6
Joined: Mon Aug 04, 2003 6:49 pm

Re: Local Cam works but remote cam doesn't

Post by sonic »

Never mind. Problem is answered in the Troubleshooting section of the readme. This was a shared memory issue. Now I've moved on to an "ERR [Select timed out]" in syslog for those remote pictures but I can see from the web logs that the images are being requested at least. I'll try to sort this out a bit more before bugging the forum any further.
sonic
Posts: 6
Joined: Mon Aug 04, 2003 6:49 pm

Re: Local Cam works but remote cam doesn't

Post by sonic »

Never mind. Problem is answered in the Troubleshooting section of the readme. This was a shared memory issue. Now I've moved on to an "ERR [Select timed out]" in syslog for those remote pictures but I can see from the web logs that the images are being requested at least. I'll try to sort this out a bit more before bugging the forum any further.
User avatar
tech_fixer
Posts: 132
Joined: Tue Jul 29, 2003 3:07 pm

Re: Local Cam works but remote cam doesn't

Post by tech_fixer »

I'm getting the same results too.

The "Select timed out" message is produced by zmc. Here's the whole log line:
Aug 5 16:10:04 misdevel zmc-h192.168.1.10[6928]: ERR [Select timed out]

This is really frustrating, since the project I'm working on will involve aroud 25 networked cameras, for surveillance purposes. If I can't get ZoneMinder to work on the deadline, I'll have to use propietary software that limits many of my hardware vendor options. Ugh!

As far as I can tell, from the sources, the only place that prints out this message is in line 190 of zm_remote_camera.cpp. The same string can be found in other places, like the perl scripts, but it is commented out so the only source of the message seems to be this file.

Phillip, any ideas?

Regards,
Jose Rodriguez
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Re: Local Cam works but remote cam doesn't

Post by zoneminder »

Hi,

The select timed out message basically indicates that zmc sent off a request to the camera for an image and has not heard back from it in ZM_HTTP_TIMEOUT milliseconds. This is set to 2500 (2.5 seconds) by default but can be modified to suit your installation. However if you find you need it to be much larger than this then you may want to investigate why it is taking this long for the camera to get the picture back.

If you try doing a 'time wget '<url>' to your image url and timing that what kind of response do you get?

Phil,
User avatar
tech_fixer
Posts: 132
Joined: Tue Jul 29, 2003 3:07 pm

Re: Local Cam works but remote cam doesn't

Post by tech_fixer »

Furthermore, in zm_remote_camera.cpp, temp_timeout is initialized as:
struct timeval temp_timeout = timeout;

and timeout is initialized in zm_remote_camera.h as
protected:
...
struct timeval timeout;
...

but, although initialized, timeout is never given a value. Now, my programming skills are really rusty, but shouldnt it have a value to be evaluated in the zm_remote_camera.cpp:
...
struct timeval temp_timeout = timeout;

int n_found = select( sd+1, &rfds, NULL, NULL, &temp_timeout );
if( n_found == 0 )
{
Error(( "Select timed out" ));
return( -1 );
}
...

Regards,
Jose Rodriguez
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Re: Local Cam works but remote cam doesn't

Post by zoneminder »

Hi Jose,

Timeout is set up in RemoteCamera::RemoteCamera as follows,

timeout.tv_sec = 0;
timeout.tv_usec = 0;

and then in RemoteCamera::Initialise() like,

if ( !timeout.tv_sec )
{
timeout.tv_sec = (int)config.Item( ZM_HTTP_TIMEOUT )/1000;
timeout.tv_usec = (int)config.Item( ZM_HTTP_TIMEOUT )%1000;
}

which I think covers most bases.

At least it should be like that, are you saying on your install it isn't?

Phil,
User avatar
tech_fixer
Posts: 132
Joined: Tue Jul 29, 2003 3:07 pm

Re: Local Cam works but remote cam doesn't

Post by tech_fixer »

When doing a 'time wget '<url>' I get:
real 0m0.748s
user 0m0.010s
sys 0m0.000s

In my install, the "timeout" initialization is just like you describe.

Any ideas?

Regards,
Jose Rodriguez
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Re: Local Cam works but remote cam doesn't

Post by zoneminder »

Hi Jose,

Do you get the select error on every image fetch or is it intermittant? On my install here my network camera is fine most of the time but now and again will just not respond, is it the same with you or every time?

Phil,
User avatar
tech_fixer
Posts: 132
Joined: Tue Jul 29, 2003 3:07 pm

Re: Local Cam works but remote cam doesn't

Post by tech_fixer »

Phil,
I get the error always.

Note that with a Phillips USB camera all works great. Network cameras are the doozie...

Does V4L support network cameras? I'll check that out... maybe try to get xawtv to work on it.

Jose.
sonic
Posts: 6
Joined: Mon Aug 04, 2003 6:49 pm

Re: Local Cam works but remote cam doesn't

Post by sonic »

FWIW In my case (in contrast to Jose) I'm using Apache web server and a single real jpeg image to provide the image. I can see from the web server logs that the image is being requested and no errors are reported on that end. Using time wget I see:

video1:/tmp# time wget http://homer/pics/demo2.jpg
--08:51:09-- http://homer/pics/demo2.jpg
=> `demo2.jpg'
Resolving homer... done.
Connecting to homer[192.168.0.1]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 145,671 [image/jpeg]

100%[=================================================================>] 145,671 8.68M/s ETA 00:00

08:51:09 (8.68 MB/s) - `demo2.jpg' saved [145671/145671]


real 0m0.025s
user 0m0.000s
sys 0m0.000s

Is there any reason this shouldn't work? My reason for doing this is to simulate a system with 8-10 cameras and get some idea of the system performance. I figured I could use mplayer to convert a video from one of the real cameras into a bunch of jpegs and a script on the web server to poing demo2.jpg at each in turn but I havn't actually done this yet, for now it's just a single static image.

Ray
User avatar
tech_fixer
Posts: 132
Joined: Tue Jul 29, 2003 3:07 pm

Re: Local Cam works but remote cam doesn't

Post by tech_fixer »

I was doing tests with a web server too, just like Ray. It would not work at all.

Then I found a rouge Axis 2400 server on the net using Google (thanks god for sloppy sysadmins). I did tests on it, and it worked beautifully.

Just do a google search for "Axis Video Server" enclosed in quotes and you'll find plenty of test subjects.

Regards,
Jose Rodriguez
olaf
Posts: 5
Joined: Sun Jul 27, 2003 2:02 pm

Re: Local Cam works but remote cam doesn't

Post by olaf »

Hi!

I think you guys describe the same problem as I did in the thread "strange effects whith network timeout".
In that thread I posted the debug output of zmc and there you can see that getting an image from a web server (Apache) tahes about 17 seconds...
I think that the first access to the image fails and than (after an internal timeout of the http access method) the second access works fine and really fast.
Unfortunatly I don't have a solution either.

Olaf.
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Re: Local Cam works but remote cam doesn't

Post by lazyleopard »

Yep, I'm seeing the same symptoms with Apache here. Apache log shows requests apparently succeeding and returning different images:

localhost - - [02/Mar/2004:23:47:32 +0000] "GET /~rick/images/webcam.jpg HTTP/1.1" 200 13257 "-" "ZoneMinder/1.18.1"
localhost - - [02/Mar/2004:23:47:34 +0000] "GET /~rick/images/webcam.jpg HTTP/1.1" 200 64067 "-" "ZoneMinder/1.18.1"
localhost - - [02/Mar/2004:23:47:36 +0000] "GET /~rick/images/webcam.jpg HTTP/1.1" 200 66866 "-" "ZoneMinder/1.18.1"

Syslog showing errors:

Mar 2 23:47:30 duma zma-m4[13608]: WAR [Waiting for capture daemon]

Mar 2 23:47:31 x zma-m4[13608]: WAR [Waiting for capture daemon]
Mar 2 23:47:32 x zmc-m4[13600]: ERR [Select timed out]
Mar 2 23:47:32 x zma-m4[13608]: WAR [Waiting for capture daemon]
Mar 2 23:47:33 x zma-m4[13608]: WAR [Waiting for capture daemon]
Mar 2 23:47:34 x zmc-m4[13600]: ERR [Select timed out]
Mar 2 23:47:34 x zma-m4[13608]: WAR [Waiting for capture daemon]
Mar 2 23:47:35 x zma-m4[13608]: WAR [Waiting for capture daemon]
Mar 2 23:47:36 x zmc-m4[13600]: ERR [Select timed out]
Mar 2 23:47:36 x zma-m4[13608]: WAR [Waiting for capture daemon]
Mar 2 23:47:37 x zma-m4[13608]: WAR [Waiting for capture daemon]
Mar 2 23:47:38 x zmc-m4[13600]: ERR [Select timed out]

zmdc.log shows:

'zma -m 4' starting at 04/03/02 23:42:04, pid = 13608
'zma -m 4' started at 04/03/02 23:42:04
'zmc -m 4' stopping at 04/03/02 23:51:30
'zmc -m 4' died at 04/03/02 23:51:30

wget time to fetch the file is 0.000u 0.000s 0:00.17 0.0% 0+0k 0+0io 321pf+0w

Anyone got a solution?
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Re: Local Cam works but remote cam doesn't

Post by zoneminder »

Hi Rick,

Your logs imply that something isn't starting right, can you check /var/log/messages and see if you get any more useful errors there?

Cheers,

Phil,
Locked