Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-01-2014, 03:26 AM
pjkcards pjkcards is offline
 
Join Date: Jul 2007
Posts: 299
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vBulletin DB Errors recently

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:
Quote:
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:
Quote:
[--] 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.
Reply With Quote
  #2  
Old 05-01-2014, 03:52 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 05-01-2014, 04:18 AM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the line 317 is to do with the username and password in your config.php
Reply With Quote
  #4  
Old 05-01-2014, 11:03 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ForceHSS View Post
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.
Reply With Quote
  #5  
Old 05-01-2014, 06:22 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The error is just stating MySQL can't connect, the error lines from the software are pretty pointless.
Reply With Quote
  #6  
Old 05-01-2014, 06:32 PM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cellarius View Post
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
Reply With Quote
  #7  
Old 05-19-2014, 06:59 AM
pjkcards pjkcards is offline
 
Join Date: Jul 2007
Posts: 299
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery View Post
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?

Quote:
Originally Posted by Zachery View Post
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.
Reply With Quote
  #8  
Old 05-19-2014, 06:09 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't know, that error generally emans MySQL is down, or otherwise unreachable.
Reply With Quote
  #9  
Old 07-24-2014, 03:44 AM
pjkcards pjkcards is offline
 
Join Date: Jul 2007
Posts: 299
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Aside from upgrading, what can be done to resolve this? Getting a lot lately. Thanks.
Reply With Quote
  #10  
Old 07-24-2014, 04:20 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you running on a dedicated server or shared webhosting?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:51 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06533 seconds
  • Memory Usage 2,259KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete