1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 An unexpected database error occurred. Please try again later

Discussion in 'Troubleshooting and Problems' started by Qaseem, Aug 17, 2013.

  1. Qaseem

    Qaseem Member

    Hello
    Having a problem, an error message while browsing Forum
    (An unexpected database error occurred. Please try again later.)

    Note: The Forum is working on a program previously vbulletin
    Then been Conversion / Jump to xenforo a recently
    This problem were not present when the forum was runs the Fbolten software

    Please help
    Thanks in advance
     

    Attached Files:

    • 0.jpg
      0.jpg
      File size:
      33.8 KB
      Views:
      92
  2. Brogan

    Brogan XenForo Moderator Staff Member

    View the page source, there may be more details.

    Errors such as this are usually related to incorrect database or config.php details.
     
    borbole likes this.
  3. Qaseem

    Qaseem Member

    Dear @Brogan
    Sorry for the delay, I was waiting for the emergence of the problem again so I can answer your question
    Prefer:

    Firefox
    Code:
    An unexpected database error occurred. Please try again later.
    <!-- User ****_yo already has more than 'max_user_connections' active connections -->
    Internet Explorer
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
        <head>
            <link rel="stylesheet" type="text/css" href="ErrorPageTemplate.css" >
    
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
            <title>HTTP 500 Internal Server Error</title>
    
            <script src="errorPageStrings.js" language="javascript" type="text/javascript">
            </script>
            <script src="httpErrorPagesScripts.js" language="javascript" type="text/javascript">
            </script>
        </head>
    
        <body onLoad="javascript:expandCollapse('infoBlockID', true); initGoBack(); navCancelInit(); initMoreInfo('infoBlockID');">
    
            <table width="730" cellpadding="0" cellspacing="0" border="0">
    
            <!-- Error title -->
                <tr>
                    <td id="infoIconAlign" width="60" align="left" valign="top" rowspan="2">
                        <img src="info_48.png" id="infoIcon" alt="Info icon">
                    </td>
                    <td id="mainTitleAlign" valign="middle" align="left" width="*">
                        <h1 id="mainTitle">The website cannot display the page</h1>
                    </td>
                </tr>
    
    
    
                <tr>
                    <!-- This row is for HTTP status code, as well as the divider-->
                    <td id="http500Align" class="errorCodeAndDivider" align="right"><ID id="http500">&nbsp;HTTP 500</ID>
                        <div class="divider"></div>
                    </td>
                </tr>
    
    
            <!-- Error Body -->
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td id="likelyCausesAlign" valign="top" align="left">
                        <h3 id="likelyCauses">Most likely causes:</h3>
                        <ul>
                            <li id="causeSiteMaintenance">The website is under maintenance.</li>
                            <li id="causeSiteError">The website has a programming error.</li>
                        </ul>
                    </td>
                </tr>
    
            <!-- What you can do -->
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td id="whatToTryAlign" valign="top" align="left">
                        <h2 id="whatToTry">What you can try:</h2>
                    </td>
                </tr>
    
            <!-- refresh page -->
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td id="refreshPageAlign" align="left" valign="middle">
                        <h4>
                            <table>
                              <tr>
                                  <td valign="top">
                                      <img src="bullet.png" border="0" alt="" class="actionIcon">
                                  </td>
                                  <td valign="top">
                                      <span id="navCancelContainer"></span><noscript id="refreshPage">Refresh the page.</noscript>
                                  </td>
                              </tr>
                            </table>
                        </h4>
                    </td>
                </tr>
    
    
            <!-- back to previous page -->
                <tr>
                    <td >
                        &nbsp;
                    </td>
                    <td id="goBackAlign" align="left" valign="middle">
                        <h4>
                            <table>
                              <tr>
                                  <td valign="top">
                                      <img src="bullet.png" border="0" alt="" class="actionIcon">
                                  </td>
                                  <td valign="top">
                                      <span id="goBackContainer"></span><noscript id="goBack">Go back to the previous page.</noscript>
                                  </td>
                              </tr>
                            </table>
                        </h4>
                    </td>
                </tr>
    
    
            <!-- InfoBlock -->
                <tr>
                    <td id="infoBlockAlign" align="right" valign="top">
                        &nbsp;
                    </td>
                    <td id="moreInfoAlign" align="left" valign="center">
                        <h4>
                            <table>
                                <tr>
                                    <td valign="top">
                                        <a href="#" onclick="javascript:expandCollapse('infoBlockID', true); return false;"><img src="down.png" id="infoBlockIDImage" border="0" class="actionIcon" alt="More information"></a>
                                    </td>
                                    <td valign="top">
                                        <span id="moreInfoContainer"></span>
                                        <noscript><ID id="moreInformation">More information</ID></noscript>
                                    </td>
                                </tr>
                            </table>
                        </h4>
    
                        <div id="infoBlockID" class="infoBlock">
                            <p id="errorExplanation">This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented  the webpage from displaying.</p>
                            <p id="moreInfoSeeHelp">For more information about HTTP errors, see Help.</p>
                        </div>
    
                    </td>
                </tr>
    
    
            </table>
        </body>
    </html>
     
    Last edited: Aug 18, 2013
  4. Brogan

    Brogan XenForo Moderator Staff Member

    You have exceeded the limit imposed by your host.

    You will need to change your hosting account or move to another host.
     
    Akalanka and Qaseem like this.
  5. Qaseem

    Qaseem Member

    Dear @Brogan
    Can you explain more? What is the thing that has been surpassed in particular?
    I own Dedicated Server
    ◦ Intel Xeon E3-1265L 2.5GHz
    ◦ 100 Mbps Uplink
    ◦ 8 GB DDR3 Memory
    ◦ 500 GB RAID-1 Drives
    ◦ 10 TB Bandwidth
     
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    Max connections is specified in your MySQL configuration. If you set it to 5, only 5 "people" can make concurrent connections to your database. All others will be rejected with the error you posted. You will either need to up the amount, contact your host to up the amount, or move servers where you/your new host can set a higher amount.
     
    Qaseem likes this.
  7. Tracy Perry

    Tracy Perry Well-Known Member

    To expand on what @Brogan and @King Kovifor have recommended, you need to go into your my.cnf file (usuallly located under /etc/mysql) and edit it and modify the
    Code:
    max_connections        = 1200
    to reflect a higher number (the 1200 in my example is what I have defined - but I am on a dedi with 24GB memory).
     
    Qaseem likes this.
  8. Qaseem

    Qaseem Member

    @Brogan @King Kovifor @Tracy Perry
    Thank you very much for your follow-up

    There are those who differ with you to solve the problem
    For more advice, I emailed the hosting company, and offered them the problem
    Has answered employee Linux Systems Administration (ATX)
    This is his answer:

    After reviewing your forum's database and queries, I've noticed that your queries do get delayed do to the number of rows in your forum, you may be able to optimize your database by creating indexes for your MySQL tables that contain thousands of rows:

    =======================================================
    +--------------------------------------+----------+------------+
    +--------------------------------------+----------+------------+
    160 rows in set.
    Database: *****_XenForo | Tables | Columns | Total Rows |
    | xf_conversation_master | 15 | 26658 |
    | xf_conversation_message | 8 | 26830 |
    | xf_template_phrase | 2 | 35975 |
    | xf_thread_watch | 3 | 36428 |
    | xf_conversation_user | 9 | 37884 |
    | xf_conversation_recipient | 4 | 57836 |
    | xf_user_field_value | 3 | 66749 |
    | xf_thread | 19 | 80424 |
    | xf_post | 17 | 1052490 |
    | xf_search_index | 8 | 1090140 |
    | xf_import_log | 3 | 1199527 |
    =======================================================

    The following link may be of use to explain how these are used:
    http://www.howtoforge.com/when-to-use-indexes-in-mysql-databases

    =======================================================

    Also, I'd recommend optimizing your tables as well. I've also reconfigured your my.cnf to run more efficiently on your dedicated server and made a backup of your previous configuration file to /etc/my.cnf.2013-08-18.bak

    =======================================================

    Also, mailman was using 25% of your server's ram and I restarted the service to alleviate the stale process.

    =======================================================





    What is your opinion?
     
    Last edited: Aug 18, 2013
  9. MattW

    MattW Well-Known Member

    I'm interested to know how they have configured MySQL to run more efficiently.

    Can you do a diff against the current my.cnf and the backed up one and put the results in here?
     
  10. Tracy Perry

    Tracy Perry Well-Known Member

    And that has absolutely nothing to do with the "max_user_connections".
    I draw your attention to:
    http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_max_connections
    http://www.question2answer.org/qa/18513/already-max_user_connections-active-connections-include

    There are a ton more - simply do a google search for max_user_connection error mysql, and you will find more of this. Has nothing to do with getting "delayed" - there are just more attempts to connect to mysql than it is set to allow.
     
    Qaseem and Jeremy like this.
  11. Tracy Perry

    Tracy Perry Well-Known Member

    What I want to see is the settings for the max_user_connections between the two. Will tell a lot.
     
    MattW likes this.
  12. MattW

    MattW Well-Known Member

    That's what I was thinking as well.
     
  13. Tracy Perry

    Tracy Perry Well-Known Member

    Just for grins and giggles I kicked mine up to 2500 and my innodb_buffer_pool_size to 8G.
     
  14. MattW

    MattW Well-Known Member

    Mine has been on 80 for a while now.
     
  15. Qaseem

    Qaseem Member

    What is the number of visitors to your site?

    You're right
    The solution that has been applied talked about hosting company employee but does not solve the problem
    The solution that you are told it is true

    Currently, the max_user_connections setting is at a value of 25:
    What is the appropriate figure, which would you recommend?


    Below is a current snapshot of RAM usage on the server:

    total used free shared buffers cached
    Mem: 7999 7861 137 0 133 5549
    -/+ buffers/cache: 2179 5820
    Swap: 4095 685 3410
    Total: 12095 8546 3548
     
    Last edited: Aug 19, 2013
  16. MattW

    MattW Well-Known Member

    Depends on how busy your site(s) are.

    I've got mine set to 80, so you could probably start with 100 and see if it happens again.
     
    Qaseem likes this.
  17. Qaseem

    Qaseem Member

    Below is a current snapshot of RAM usage on the server:

    total used free shared buffers cached
    Mem: 7999 7861 137 0 133 5549
    -/+ buffers/cache: 2179 5820
    Swap: 4095 685 3410
    Total: 12095 8546 3548
     
  18. MattW

    MattW Well-Known Member

    Set it to 100 then and see how it goes for the next couple of days. Without seeing your full my.cnf file, it's hard to really suggest settings (and knowing how large / busy your site is).
     
    Qaseem likes this.
  19. Qaseem

    Qaseem Member

    Well, I'll tell you the result after two days
    All Thank you very much for your help ^_^
     
    MattW likes this.
  20. Tracy Perry

    Tracy Perry Well-Known Member

    Only have 10 or so registered users on one forum and 5 on the other. With guests/bots one gets upwards of 35 or so at one time, the other 12.
    I just run each forum on a dedicated server with 24GB of RAM, so I can throw extra connections in there without to much worry.
    Try bumping it up to 75-100 and see how that does.
     
    Akalanka and Qaseem like this.

Share This Page