httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Coombes" <philip.coom...@triornis.net>
Subject Re: [users@httpd] Apache children not dying
Date Thu, 06 Nov 2003 21:46:37 GMT
Hi (apologies if the mail isn't formatted correctly, I've only just joined
and had to paste from the archives!)

I have this problem too!

I have written a GPL video security suite call ZoneMinder
(http://www.zoneminder.com) and part of that is a simple c++ program called
via cgi which just sends streaming images in multi-part/replace format to
stdout to allow users to monitor their cameras. These images are then
displayed either via native browser support for Mozilla et al or in a Java
plugin for IE. Either way, closing the window that contains the stream
leaves the generating program going for ever. The file descriptor it is
writing to never errors or blocks whether it is buffered or not and over
time tens if not hundreds of these cgi processes build up each with their
own httpd to keep it company. Eventually this brings the server to it's
knees as there's no way for the cgi programs to detect that the client has
disappeared. The streaming program does not do anything clever with
descriptors or pipes or any other processes and is basically a simple loop
writing to stdout..

I'm using apache 2.0.40 on RH9 by the way, and this problem does not occur
on apache 1.3 which closes down the defunct scripts within a few seconds if
not immediately. At the moment my users have to ensure that they stick to
(or downgrade to) 1.3 in order to do any monitoring and I would love to
crack this problem, it would reduce my support load substantially!

Cheers,

Phil,

> Hi,
>
> I've tested the program and it does respond to SIGPIPE and dies
> appropriately. I also altered the script to use passthru instead of
> popen and fpassthru and the symptoms still persist.
>
> Matt
>
> On Tue, 2003-11-04 at 20:41, Brian Dessent wrote:
> > Matt Wright wrote:
> > >
> > > Hi,
> > >
> > > I already checked this, ignore_user_abort is set to off in php.ini. So
> > > php would stop if apache asked it to. Well as far as I can see. I
don't
> > > see any point in setting ignore_user_abort to true as the php script
> > > itself won't end on its own as its a streamer.
> >
> > You also mentioned that the script popen()s a process, right?  You
> > should check that this process (or chain of processes) exits on a broken
> > pipe.  You might be able to test this locally with netcat or something.
> > It could be that PHP does sense that the user has aborted and tries to
> > terminate and close the open pipe.  But if this process doesn't respond
> > to SIGPIPE or the broken pipe or whatever PHP is sending then the
> > process will hang around forever or until it decides to exit on its
> > own.  Maybe you should try proc_open() or passthru() instead of popen()?
> >
> > Brian
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
>
>
>



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message