View Full Version : Solved too many connections db error during cache update

17-12-09, 01:17
The other night I happened to be awake a little after 4 in the morning, where the forum suddenly was down for like 20 min:

Database error in vBulletin :

mysqli_real_connect() [<a href='function.mysqli-real-connect'>function.mysqli-real-connect</a>]: (08004/1040): Too many connections
/var/www/vhosts/.../httpdocs/includes/class_core.php on line 1138

MySQL Error :
Error Number :
Request Date : Tuesday, December 15th 2009 @ 04:28:00 AM
Error Date : Tuesday, December 15th 2009 @ 04:28:00 AM
Script : http://.../
Referrer :
IP Address :
Username :
Classname : vB_Database_MySQLi
MySQL Version :

Now, I never experienced this before, and I am wondering, if it was a coincidence, that this was around the vb cache update in scheduled tasks.

I checked this morning and everything was ok, so it didnt repeat today.

The server seemed not to be stressed, since I had another forum on same server without vbet, that was running fine during the downtime of my vbet forum.

Looking at the serverlog, there did seem to be some bot activity, but not much user activity. The bots seemed to get OK 200 - but normal users got dberror. Also strangely the records in the server logfile seems not to be sorted chronologically ...

A bit of a puzzele ... perhaps you can tell me if includes/class_core.php on line 1138 is involved in updating the cache ? Or perhaps some of you have an idea how to troubleshoot this?

17-12-09, 01:31
vBET does not create new connections - it can reestablish connection but this is made only if actual one is lost (in case if translations comes too late from Google). And this connection is made by $vbulletin->db->connect so vBulletin made all necessary clearing at the end.

So at this moment we think that the issue is somewhere else.

class_core.php is not our file and it does not use directly vBET cache - but if this file is responsible for execution of scheduled task, then it will also execute cache clearing.

17-12-09, 01:54
One more thing. If you are writing about vBET cache clearing, then please heck how many data you have in cache. If it is really big amount, then please change your cache clearing strategy.
vBET does not create additional connections, but if clearing takes too long, then other clients are waiting and new connections are created by vB for new clients, which ill wait. this is why we add several clearing strategy. For really big amount of data please use last strategy.

Please note that this issue will be minimized in 3.3.0 since we will split cache tables for each language, so your indexes will be 52 times smaller and clearing will be much faster - deleting data is fast, but updating large indexes not necessary. So at this moment please consider usage of other clearing strategy, which are better for large indexes :)

17-12-09, 05:22
Happend again from 04-05 - all domains down with too many connections. I think you are right. Forum is busy clearing the cache and search bots are tampering with one request per second. I could see serverload was extremely high. Now it is very low again. vbet db approx 1.1 GB

I have switched to "Delete all cache data once for cache TTL interval".

Sounds very good indeed 330 addresses this problem!

AfrikaansAlbanianArabicBelarusianBulgarianCatalanChineseCroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTaiwaneseThaiTurkishUkrainianVietnameseWelshYiddish
Integration with Google translations by vB Enterprise Translator 4.9.99