Bug #67061 [NEW]: mysqli don't work with pcntl_fork

From: Date: Sat, 12 Apr 2014 23:16:52 +0000
Subject: Bug #67061 [NEW]: mysqli don't work with pcntl_fork
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185189@lists.php.net to get a copy of this message
From: aurelien dot lequoy at esysteme dot com Operating system: Debian 7.4 PHP version: 5.5.11 Package: MySQLi related Bug Type: Bug Bug description:mysqli don't work with pcntl_fork Description: ------------ We have to close connection MySQL before to use pcntl_wait and repoen it after to make it work. Or when the son dead and get back with father. Test script: --------------- <?php $db = new MySQLi('localhost','root','zeb33tln'); if (pcntl_fork()) { echo "pid du pere ".getmypid().PHP_EOL; $status = 0; $result = $db->query('select version()'); if ($db->error) echo "error 1".$db->error.PHP_EOL; //pcntl_wait($status); $result = $db->query('select version()'); if ($db->error) echo "error 2".$db->error.PHP_EOL; } else { echo "pid son ".getmypid().PHP_EOL; $result = $db->query('select version()'); if ($db->error) echo "error 3".$db->error.PHP_EOL; exit; } $result = $db->query('select version()'); if ($db->error) echo "error 4".$db->error.PHP_EOL; echo "END".PHP_EOL; Expected result: ---------------- pid du pere 26717 pid son 26718 END Actual result: -------------- pid du pere 26749 pid son 26750 PHP Warning: Packets out of order. Expected 1 received 5. Packet size=31 in /home/www/glial/testmysql.php on line 11 PHP Warning: mysqli::query(): MySQL server has gone away in /home/www/glial/testmysql.php on line 11 PHP Warning: mysqli::query(): Error reading result set's header in /home/www/glial/testmysql.php on line 11 error 1MySQL server has gone away error 2MySQL server has gone away error 4MySQL server has gone away END PHP Warning: Packets out of order. Expected 3 received 0. Packet size=65029 in /home/www/glial/testmysql.php on line 24 PHP Warning: mysqli::query(): MySQL server has gone away in /home/www/glial/testmysql.php on line 24 error 3MySQL server has gone away -- Edit bug report at https://bugs.php.net/bug.php?id=67061&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67061&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67061&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67061&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=67061&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=67061&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=67061&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=67061&r=needscript Try newer version: https://bugs.php.net/fix.php?id=67061&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=67061&r=support Expected behavior: https://bugs.php.net/fix.php?id=67061&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=67061&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=67061&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=67061&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67061&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=67061&r=dst IIS Stability: https://bugs.php.net/fix.php?id=67061&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=67061&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=67061&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=67061&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=67061&r=mysqlcfg

« previous php.bugs (#185189) next »