From:             jketterl at chipxonio dot de
Operating system: linux (debian)
PHP version:      5.2.6
PHP Bug Type:     MySQL related
Bug description:  PDO closes connection too early when combined with 
pcntl_fork()

Description:
------------
When forking a php skript using pcntl_fork, the PDO connections to a MySQL
server are lost as soon as one of the processes exits (parent or child,
which ever exits first) and the remaining process can't continue to execute
queries (or, even worse, is interrupted during an active query).

the code to reproduce is a CLI script as the application i'm working on is
one too. you will need to replace username & password. also, I had to
change the file extension in order to make it downloadable.

Reproduce code:
---------------
http://www.djmacgyver.net/files/test2.php.txt

Expected result:
----------------
before fork
records returned: 1
child
records returned: 1
parent
records returned: 1
after fork
records returned: 1
end

Actual result:
--------------
before fork
records returned: 1
child
records returned: 1
parent
records returned: 1
after fork
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
#0 /home/jketterl/public_html/me/application/import/test2.php(5):
PDO->query('select * from p...')
#1 /home/jketterl/public_html/me/application/import/test2.php(41):
doQuery(Object(PDO))
#2 {main}
end


-- 
Edit bug report at http://bugs.php.net/?id=45797&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45797&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45797&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45797&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45797&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45797&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45797&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45797&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45797&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45797&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45797&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45797&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45797&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45797&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45797&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45797&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45797&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45797&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45797&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45797&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45797&r=mysqlcfg

Reply via email to