#38228 [NEW]: Pcntl based parallel threads loose connection to MySQL server
| From: | piotr at bulczak dot name | Date: | Wed, 26 Jul 2006 20:09:18 +0000 |
| Subject: | #38228 [NEW]: Pcntl based parallel threads loose connection to MySQL server | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-99953@lists.php.net to get a copy of this message | ||
From: piotr at bulczak dot name
Operating system: Fedora Core 5 Linux
PHP version: 5.1.4
PHP Bug Type: MySQL related
Bug description: Pcntl based parallel threads loose connection to MySQL server
Description:
------------
For long time I was using multithreaded scripts (pcntl module). Each
script was using their own connection to MySQL server (mysql module). They
are working properly on FC1 - FC4 linuxes (PHP 4.3.11 - 5.0.4). I tried for
the first time to tun them on FC5 which includes standard rpm packages -
PHP 5.1.4 in this case (iptables and selinux turned off).
I noticed that my threads fail with message "server has gone away" when
using "mysql_select_db. The behaviour is the same regardless if it is
connection via unix socket file, tcp/ip connection to localhost or some
remote IP address. It does not matter what MySQL server version I am
connecting to (tried with 3.23.58 - 5.0.22)
I tried also switch to "mysqli" module on FC5 and the script started
working properly again so I assume only "mysql" module is affected.
I do not have major changes to standard php.ini... just
max_execution_time=300 and memory_limit=32M. Test script is just a minimal
version (without any threads synchronization, etc. stuff).
Please help :-)
Reproduce code:
---------------
http://www.buleksoft.pl/mysql_pcntl_test.html
Expected result:
----------------
[root@host ~]# php -q test.php
Forking thread number 0
Thread 0 doing some mysql tasks
Forking thread number 1
Thread 1 doing some mysql tasks
Forking thread number 2
Thread 2 doing some mysql tasks
Forking thread number 3
Thread 3 doing some mysql tasks
Actual result:
--------------
[root@host ~]# php -q test.php
Forking thread number 0
Thread 0 doing some mysql tasks
Forking thread number 1
Thread 1: Could not select DB because MySQL server has gone away
Forking thread number 2
Thread 2: Could not select DB because MySQL server has gone away
Forking thread number 3
Thread 3: Could not select DB because MySQL server has gone away
--
Edit bug report at http://bugs.php.net/?id=38228&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38228&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38228&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38228&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38228&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38228&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38228&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38228&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38228&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38228&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38228&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38228&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38228&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38228&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38228&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38228&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38228&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38228&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38228&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38228&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38228&r=mysqlcfg