From:             rui dot francisco at fccn dot pt
Operating system: linux kernel 2.4.22
PHP version:      5.0.2
PHP Bug Type:     InterBase related
Bug description:  broken db connection lost after fork

Description:
------------
i query a db (firebird 1.5.1)for a resultset
I use a loop to go to all the records
in the record processing i fork ()
  in there i use shell_exec with the no hup
  terminate the child

in the parent i verify a log file
if the string i want is there i kill the child
wait for the child

when i try to update the db using the same db connection, or one new its
reports a broken pipe

The script was originally built using Pear DB, but i change it to ibase
function to garante that wasn't a Pear DB bug.

I compiled php with the following configuration

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-ssl
--with-libxml --with-interbase=/opt/firebird --with-pear --with-zlib
--enable-sockets --enable-track-vars --enable-pcntl -enable-debug


My compiled modules
[EMAIL PROTECTED]:/usr/src/php-5.0.2# php -m
[PHP Modules]
ctype
dom
iconv
interbase
libxml
pcntl
pcre
posix
session
SimpleXML
sockets
SPL
SQLite
standard
tokenizer
xml
zlib



Thanks in advance
Rui Francisco

Reproduce code:
---------------
$pid=pcntl_fork();

if ($pid == -1) 
        {
                 echo "Erro ao efectuar o fork\n";
        } 
else if ($pid) 
        {
                // we are the parent
                $resultado='-----';
                //sleep(4);
                while ($resultado=='-----') {
                        sleep(2);
                        $a=shell_exec("cat xsupplicant.log");
                        
                        if (strpos($a,'Failure',0)) {
                                $resultado='SC';
                                shell_exec('ifconfig '.$vInterface.' down');
                                shell_exec('killall xsupplicant');
                                sleep(2);
                                shell_exec('ifconfig '.$vInterface.' up');
                        }                                       
                        if (strpos($a,'Authenticated',0))
                                $resultado='A';
                }
                pcntl_wait($status);
        } 
else 
        {
                // we are the child
                ob_start();
                shell_exec('killall xsupplicant 2>&1');
                shell_exec('rm /var/run/xsupplicant 2>&1');
                ob_end_clean();
                sleep(1);
                $a=shell_exec("nohup xsupplicant -c conf_teste.conf -i 
".$vInterface." &
");
                exit (0);
        }

echo $vDominio." - ".$resultado."\n";



Expected result:
----------------
update the database, no message

Actual result:
--------------
Warning: ibase_query(): Unable to complete network request to host
"localhost". Error writing data to the connection. Broken pipe  in
/web/roam/test_connectivity.php on line 210
Unable to complete network request to host "localhost". Error writing data
to the connection. Broken pipe

-- 
Edit bug report at http://bugs.php.net/?id=30805&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30805&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=30805&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=30805&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30805&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30805&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30805&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30805&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30805&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30805&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30805&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=30805&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=30805&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30805&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30805&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30805&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30805&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30805&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30805&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30805&r=mysqlcfg

Reply via email to