PDA

View Full Version : vBulletin DB Errors recently


pjkcards
05-01-2014, 03:26 AM
I've been getting a few of these recently, but didn't happen much before. Travel has remained mostly constant for the last year so not sure why it is happening now:
Database error in vBulletin :

mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11)
/home/x/public_html/sss/forum/includes/class_core.php on line 317

I contacted my host about this and they replied with this:
[--] Total buffers: 770.0M global + 9.3M per thread (500 max threads)
===

This means mysql by itself, without apache, without exim, just mysql, has 770 MB of memory just to run. Then, each connection adds another 9.3 MB. Your server only has 2560 MB of RAM:
===
root@host [~]# free -m
total used free shared buffers cached
Mem: 2560 599 1960 0 0 0
-/+ buffers/cache: 599 1960
Swap: 0 0 0
===

When the server runs completely out of memory, the kernel throws an OOM (Out Of Memory) error, wherein it starts killing processes to prevent the server itself from crashing. It usually starts with the processes taking up the most memory. If the mysql process is taking the most memory, it is likely to be the one chosen to be killed. However, if mysql is killed in this way, it can cause crashed tables. If a table is crashed, all subsequent queries to that table will fail, which usually has a much greater impact on the site than a few queries failing momentarily due to having reached the max_connections amount.

For this reason, it is not recommended to allow mysql to use more than 80% of the server's memory, to help prevent this issue from occuring. At 137 allowed connections, that would be 770M +9.3M * 137, or about 2044 MB, which is just slightly under 80% of the total ram of 2560 MB. This is how I arrived at this number for a max_connections to try for now.

If you do need more connections than this simultaneously, then it is very strongly recommended to reduce other mysql variables to either reduce the memory overhead (the ammount mysql takes even with zero connections), or the ammount of memory taken for each connection. If you do not know what these values need to be set to, it is strongly recommended to find a developer to help you. Once you know what the settings need to be set to, I can help you set them, if you let me know what settings need to be changed and what they need to be set to.

Another option of course is to add more memory to the server, however, if the site is inefficiently coded, it may still take up the server's resources even if there are more.

In the last hour, there have been 204 joins performed without indexes, and many temporary tables created to the disk:
===
[--] Up for: 1h 5m 11s (301K q [77.047 qps], 15K conn, TX: 7B, RX: 69M)
[!!] Joins performed without indexes: 204
[!!] Temporary tables created on disk: 46% (5K on disk / 12K total)
===

I strongly recommend finding a developer to help you fix these queries.

Any ideas how to fix this? Do I need to add more memory or there another solution? I'm running vB 4.2.1 and have been pretty much since it came out. And here are the versions of Apache, PHP, and mySQL:
Apache version 2.2.21
PHP version 5.2.17
MySQL version 5.1.73-cll

Thanks.

Zachery
05-01-2014, 03:52 AM
You should update MySQL, however, according to that free, you have 1.7gb of free memory, and are only using 700mb.

You should reduce the number of connections though, chances are you don't need 500.

ForceHSS
05-01-2014, 04:18 AM
the line 317 is to do with the username and password in your config.php

cellarius
05-01-2014, 11:03 AM
the line 317 is to do with the username and password in your config.php
Yeah, well, of course you need username and password to connect to the database, that's the whole point of it. But what does that have to do with the error of the OP? He does not have a password or username issue.

Zachery
05-01-2014, 06:22 PM
The error is just stating MySQL can't connect, the error lines from the software are pretty pointless.

ForceHSS
05-01-2014, 06:32 PM
Yeah, well, of course you need a username and password to connect to the database, that's the whole point of it. But what does that have to do with the error of the OP? He does not have a password or username issue.
Pointing out what the line in that php means. Just because I pointed it out it does not mean this is the problem he is getting

pjkcards
05-19-2014, 06:59 AM
You should update MySQL, however, according to that free, you have 1.7gb of free memory, and are only using 700mb.

You should reduce the number of connections though, chances are you don't need 500.
I will update it. However, if that isn't the issue, what is causing all these errors?

The error is just stating MySQL can't connect, the error lines from the software are pretty pointless.
Why can't it connect?

Thanks for your help, much appreciated.

Zachery
05-19-2014, 06:09 PM
Don't know, that error generally emans MySQL is down, or otherwise unreachable.

pjkcards
07-24-2014, 03:44 AM
Aside from upgrading, what can be done to resolve this? Getting a lot lately. Thanks.

Zachery
07-24-2014, 04:20 AM
Are you running on a dedicated server or shared webhosting?

pjkcards
07-24-2014, 11:26 AM
Running on a VPS, which has worked fine for years and there isn't any increase in traffic.

Running MySQL 5.6 now, with vB 4.2.1. Any other ideas to look into would be appreciated.

Thanks.

--------------- Added 1406278992 at 1406278992 ---------------

We got about 12,000 more of these errors in the last 24 hours.

We've upgraded MySQL as recommended, what more can we do? Traffic has stayed relatively the same over the last few months, but this last month we've got tons of these "too many connection" errors.

Any idea why this is happening now? Is adding more RAM the only option?

Thanks.

pjkcards
07-28-2014, 09:16 AM
bump. The innodb or ibdata1 file seem to be massive (according to what my server support says), I think during the upgrade (though not sure, just didn't have space issues before). It is now causing our server to fill up and throw a bunch of errors. I'm looking to hire a developer to resolve these issues related to this.

Any help would be much appreciated.

Thanks.

Lynne
07-28-2014, 04:41 PM
I would suggest you post in the Server Configuration forum on vbulletin.com and then George can tell you which mysql variables to change.