In include/query.php in query_appdb() we only call mysql_connect() if the global $hAppdbLink isn't a valid resource. So, when a user connects to display a page the first query should open the connection and upon completion of the script $hAppdbLink will be freed and the connection should be closed. So I'm not sure that this is the cause of the out-of-connections issue although I don't see a reason why we shouldn't just let php take care of this internally and apply a variation of your change where we always attempt to connect and select the appropriate database and remove the global handle and the resource check etc.
Chris
On Wed, Feb 20, 2008 at 6:01 PM, Jeff Zaroyko jeffzaroyko@gmail.com wrote:
The mysql database for the appdb/bugzilla appears to have gone down again, I decided to look at the connection code in the appdb, as the appdb is thought to be the culprit.
I came across the call to mysql_connect which is using the new_link parameter set to true, which is supposedly to force a new connection to be established.
So, I searched through the git commit history using gitk and saw that Paul van Schayck made a change introducing this, apparently because mysql was having stability issues, back in 2005.
http://www.winehq.org/pipermail/wine-patches/2005-January/014985.html
my understanding is that php will automagically reuse connections if this is not set, would there by any objection to trialling a removal of this option to see if stability increases?