Re: PHP broken pipe in fork

From: Date: Tue, 16 Nov 2004 16:04:09 +0000
Subject: Re: PHP broken pipe in fork
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-13873@lists.php.net to get a copy of this message
>> I'm using a query in loop and go through all records to do some >> operations in the middle of the script i fork(); to do other things >> When i return to the parent process i try to make one update and i >> get the following error [nativecode=Unable to complete network >> request to host "127.0.0.1". Error writing data to the connection. >> Broken pipe] > > That would be a fairly well known issue with PHP. You're running into > the same thing we encountered about 2 years ago. What happens is that > your child process is closing the mysql connection as part of its > standard PHP cleanup procedures, leaving the parent with a broken > connection. > > I'd recommend provisioning a method so that your child makes its own new > connection, and does not use the parent's connection at all. Since all > php scripts clean up before exiting, you need to make sure all resources > in use by the child are not needed by the parent after the child exits. > Or just use persistent resources (i.e.: mysql_pconnect() ) -Sara

« previous php.internals (#13873) next »