Re: PHP broken pipe in fork

From: Date: Wed, 17 Nov 2004 18:01:41 +0000
Subject: Re: PHP broken pipe in fork
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-13887@lists.php.net to get a copy of this message
user@domain.invalid wrote:
The child process doesn't use any database connection, just to run some shell scripts, but it closes the connection anyway.
You still don't get it. As a fork, the child process has all of the same resources as the parent before the fork occurred. When the child exits, it will close those resources, leaving the parent high and dry.
I initialy used PEAR DB and then _pconnect functions but the result is the same.
Not sure why that would be. Maybe the CLI doesn't honor _pconnect based functions, since pconnect was originally designed for keeping connections persistent across server processes.
Was the bug solved two years ago ?
This is *not* a bug. It is a natural part of how PHP cleans up after itself. There are many ways to circumvent this, but are left as an exercise for the programmer. In our case, we did a test on the connection at all times before using it, and reconnected if the resource was ever closed or invalid; your mileage may vary. -- Shaun M. Thomas INN Database Administrator Phone: (309) 743-0812 Fax : (309) 743-0830 Email: sthomas@townnews.com Web : www.townnews.com

« previous php.internals (#13887) next »