adodb connection under mysql : retries to avoid max_user_connections
|
o_dupuis
![]()
Joined: 2002-08-28
Posts: 4 |
Posted: Wed, 2005-11-09 15:26
|
|
Hi, To avoid that I modified the adodb_mysql.inc to add a 3 times retry when the connection fails, with a 1 sec pause between them. I modified the source only for php>=4.3 but it is straight forward to do the same for the other versions. Here is the new _connect function of /lib/adodb/drivers/adodb_mysql.inc : --------------------------------------------------------------------------------------------------------- if (ADODB_PHPVER >= 0x4300){ while (($i<3)&&(!$this->_connectionID)) } } if ($this->_connectionID === false) return false; --------------------------------------------------------------------------------------------------------- |
|
| Login or register to post comments |


Posts: 32246
why not just use persistent connections?
there's a switch for that in
config.php
Posts: 4
But as far as I know persistent connections make each apache (in my case) process keep its existing connection to reuse it. But there are more than 3 apache servers running, so I might get out of connections ? Or am I completely mistaken.
PS : thanks for your reply
Posts: 1
Yes ! Finaly a solution !
A thousand thanks, o_dupuis.
Same company (OVH) and same problem. I've tried dozen solutions found here and there about broken thumbnails, but nothing was working, until yours.
(and with persistant connections -> not better).
I just slighly modified your hack to do a "sleep(rand(1, 3))" and my "while" counts up to 10 (what a ugly stuff !
), to avoid problems with big thumbnail pages, and now everything is OK (except, of course, the page loading slower, but not that much in fact, maybe 2-3 seconds more, not a big deal).
Thanks again.