You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Matt Wright <ma...@consultmatt.co.uk> on 2003/11/04 13:09:49 UTC

[users@httpd] Apache children not dying

Hi,

I've come across a strange problem with apache recently. Firstly this
happens with both version 2.0 (my redhat machine) and a 1.3 server. I
have a script (php) that streams an mp3 stream compressed from the
soundcard. I work for a student radio station and we're trying to
develop an alternative to streaming with RM. The streaming works fine,
the problem is that when the client closes their connection apache
doesn't realise. It keeps transmitting data forever. We've left it
running overnight and the streams only died when we HUP'd apache. This
is quite annoying because the stream script opens popen pipe to a
program and we can't leave them going indefinately as the server will
eventually die.

Is there any reason why apache can't detect that the client has closed
their connection. Surely the TCP stream stops getting ACK's from the
client. I thought "Timeout 300" should persuade it to stop 5 minutes
after they close the connection but it doesn't. It seems strange that
someone can terminate the TCP connection and Apache doesn't know about
it.

Regards,

Matt Wright


---------------------------------------------------------------------
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


[users@httpd] Re: Apache children not dying

Posted by wwwwizard <je...@interverse.com>.
Did you ever figure this out?  I have the same problem with a long
running script.


-- 
wwwwizard
------------------------------------------------------------------------
wwwwizard's Profile: http://unixadmintalk.com/867
View this thread: http://unixadmintalk.com/showthread.php?t=35897



---------------------------------------------------------------------
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


Re: [users@httpd] Apache children not dying

Posted by Matt Wright <ma...@consultmatt.co.uk>.
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


Re: [users@httpd] Apache children not dying

Posted by Brian Dessent <br...@dessent.net>.
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


Re: [users@httpd] Apache children not dying

Posted by Matt Wright <ma...@consultmatt.co.uk>.
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.

Matt

On Tue, 2003-11-04 at 19:47, Brian Dessent wrote:
> Matt Wright wrote:
> 
> > develop an alternative to streaming with RM. The streaming works fine,
> > the problem is that when the client closes their connection apache
> > doesn't realise. It keeps transmitting data forever. We've left it
> > running overnight and the streams only died when we HUP'd apache. This
> 
> This has nothing to do with Apache and everything to do with PHP.  You
> have to make sure that PHP is configured to kill the script when the
> user aborts.  See
> <http://www.php.net/manual/en/features.connection-handling.php>
> 
> 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


Re: [users@httpd] Apache children not dying

Posted by Brian Dessent <br...@dessent.net>.
Matt Wright wrote:

> develop an alternative to streaming with RM. The streaming works fine,
> the problem is that when the client closes their connection apache
> doesn't realise. It keeps transmitting data forever. We've left it
> running overnight and the streams only died when we HUP'd apache. This

This has nothing to do with Apache and everything to do with PHP.  You
have to make sure that PHP is configured to kill the script when the
user aborts.  See
<http://www.php.net/manual/en/features.connection-handling.php>

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