Page 1 of 3

Maxopenfile reached & machine hangs zm problem ?

Posted: Thu Apr 09, 2009 10:28 am
by fc
Hi to all
I'm using archlinux from the livecd I'm now using 4 cams:
1-Gadspot (mjpeg)
2- Desecurity cam (rtsp)
3- icamview ptz (with icamview proxy)
4- Icamview cam (icamview proxy)

Wha is happening is that after a few hours of working my machine get max open file reached 58700.. and this what is really configured in /proc/sys/fs/file-max.
I tried to increase this but on reboot i get the same number on file-max.
The issue is that why do i have 58700 open is this an apache bug ?
because if i do a lsof i don't have 58700 file opened....
any clue ??

thanks

Posted: Fri Apr 10, 2009 2:23 pm
by fc
somthing to do with ZM..
after 10 hours uptime i have this
"
[root@zmhost shm]# cat /proc/sys/fs/file-nr
40704 0 50837
"
then i do this
[root@zmhost shm]# /etc/rc.d/zm stop
:: Stopping ZoneMinder [DONE]
[root@zmhost shm]# cat /proc/sys/fs/file-nr
896 0 50837

and my open files come down to 896 ???

why ? any1 knows ?

thanks

Posted: Fri Apr 10, 2009 10:54 pm
by vpetersson
fc,

It could be the FD_SETSIZE in one of the dependencies (set when compiling). This flag also controls the maximum files. But I've gone crazy in the past trying to hunt down similar problems. Take a look at all the sysctl values tho, you're likely to find something there too (i.e. maxfiles and maxfilesproc).

Posted: Tue Apr 14, 2009 12:08 pm
by zoneminder
There should be no reason why ZM should have so many files open. Nor should apache have any ZM files open unless you are actively using the interface.

Perhaps you could experiment by seeing what the number does if you don't use the web interface for instance. Also if you switch off certain monitors in case it is an issue withthe proxy for example.

Posted: Tue Apr 14, 2009 6:48 pm
by fc
i don't know where are the open files, because if i do "lsof" they don't apear...
This issue occurs even without any interface interaction...
Until i found whats up i scheduled zm restart every night at 4am...

Any clue where to check the open files ? something to with /dev/shm ?
zoneminder wrote:There should be no reason why ZM should have so many files open. Nor should apache have any ZM files open unless you are actively using the interface.

Perhaps you could experiment by seeing what the number does if you don't use the web interface for instance. Also if you switch off certain monitors in case it is an issue withthe proxy for example.

Posted: Fri May 01, 2009 8:17 am
by delian
I've the same problem.. I'm using archlinux.
I've tried to increase the open file limit to an higher value ( open files (-n) 10240 ) but still the same problem..


Any other hint?

Posted: Sun May 03, 2009 10:39 pm
by rsdvd
Do you leave the Montage view open?

I have a similar problem in CentOS, if I leave the Montage view open in a browser it will generate hundreds of httpd processes each with files open......this eventually hits either the apache maximum if I set ti low enough of hangs when it runs out of file handles.

I am not sure what causes this, but I am beging to believe it might be a bug in the montage code.

related topics

Posted: Mon May 04, 2009 1:52 pm
by henriquejf
Maybe you can find these usefull posts regarding the same simptoms,

* apache hanging (this topic)
** maxopenfile reached:: http://www.zoneminder.com/forums/viewtopic.php?t=13486

** apache not responding:: http://www.zoneminder.com/forums/viewtopic.php?t=13322

** Apache instances/responsiveness issue...solved:: http://www.zoneminder.com/forums/viewto ... c&start=15

I modestly think that there should be a way to "elegantly" close the montage view, so that related zms childs would close for sure; I think my problem is related to yours because after letting the montage open for more than 2 minutes gives me problems; i am actively trying to have that solved, but still no success;

duplicated topics

Posted: Mon May 04, 2009 6:21 pm
by henriquejf
In an effort to solve, or even organize related problems, i am asking users experiencing **APACHE HANGS** to double check what has been tried before by other users, so we don´t loose our time and get things working as expected;

I am not even sure that it is a ZM bug, but i am sure that many people have to restart apache from time to time, just as me; One user found it useful to restart apache as a cron job every x minutes, another user proposed to use http://jzmconsole.securitykit.net/ as a workaround for the problem when it happens in the montage view, but i am sure that we´ll have that fixed soon by the community, so we don´t have to give up and try the mentioned workarounds;


apache hanging problems - related, duplicated (or not) topics
==============================================================


** Maxopenfile reached & machine hangs zm problem ?
http://www.zoneminder.com/forums/viewtopic.php?t=13486

** apache not responding
http://www.zoneminder.com/forums/viewtopic.php?t=13322

** Apache instances/responsiveness issue...solved(?)
http://www.zoneminder.com/forums/viewto ... c&start=15

** Zoneminder UNSTABLE & HANGS, needs frequent restarting
http://www.zoneminder.com/forums/viewto ... 1196#51196

** hundreds of httpd processes
http://www.zoneminder.com/forums/viewtopic.php?t=13588


If some experienced programmer could give us a light, it would be so kind !!

Posted: Mon May 04, 2009 10:05 pm
by cordel
This should be patched already in SVN, are you running the latest version?

Posted: Mon May 04, 2009 11:19 pm
by henriquejf
I am currently using 1.24.1 SVN as of april 14th, 2009;

(I have searched into /usr/src/zm to get the exact svn number I used but i wasnt able /didnt find out how even searching the web);

anyway, ill try the ubuntu guide available on the wiki once again, use the newer SVN and make my prays; iĺl be advising what i got by tomorrow;

I knew that when this problem started to get popular a big chief like you would come and help us poor people; TKS so much for your and the community efforts !!!

Posted: Mon May 04, 2009 11:31 pm
by mitch
ive released an updated version of my patch which may solve some of this issue it is at:
http://www.zoneminder.com/forums/viewto ... highlight=

If you just want the changes that could make apache behave better see the shorter patch at:
http://mitchcapper.com/zm_streams.patch

Posted: Mon May 04, 2009 11:46 pm
by cordel
It's not so much of how much a problem it is as much as the time available to work on it. :evil:

Posted: Mon May 04, 2009 11:53 pm
by henriquejf
that is for sure !

Tks once again !

Posted: Tue May 05, 2009 4:10 am
by MrEvoMan
mitch wrote:ive released an updated version of my patch which may solve some of this issue it is at:
http://www.zoneminder.com/forums/viewto ... highlight=

If you just want the changes that could make apache behave better see the shorter patch at:
http://mitchcapper.com/zm_streams.patch
Can you inform us non-developers how to apply a patch like this?

Thanks!