$50 PayPal today to whoever fixes this - MySQL "Too many connections"

Discussion in 'MySQL' started by ssanders82, Jun 19, 2008.

  1. #1
    Zone.net VPS, 1GB Ram. PHP5 / MySQL5.05 / CentOS 4.6

    Yesterday afternoon I began getting error emails from my custom PHP error handler saying "Error [2] mysql_connect() [function.mysql-connect]: Too many connections".

    Here's the data:
    - I am using mysql_connect, not pconnect. Just to make sure, I added mysql_close at the bottom of each page and even ini_set mysql.allow_persistent=0.
    - I bumped max_connections up to 1200. Made no difference.
    - SHOW FULL PROCESSLIST only shows 2 or 3 processes at any given time. The site gets about a hit every second.
    - Other variables of note: wait_timeout=6, interactive_timeout=6, connect_timeout=10
    - No queries take more than 1 second, everything indexed, etc. Page loads relatively quickly. PM me if you need the url.
    - Zone.net support is Bulls***, they don't know what they're doing

    I thought it was clear-cut: if Show Processlist was >= max_connections, it will start giving "too many connection" errors. But it's not even close to 1200 threads at any given time. Max_used_connections is 3. slow_queries=0. WTF?

    PM me for other variables or anything that would help you. I will pay $50 with a big smile on my face to anyone who can figure this out!

    Sam
     
    ssanders82, Jun 19, 2008 IP
  2. LoCo

    LoCo Well-Known Member

    Messages:
    232
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #2
    i dont know your code, but maybe its an error in your script that causes this
     
    LoCo, Jun 19, 2008 IP
  3. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #3
    shallowink, Jun 19, 2008 IP
  4. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #4
    Open a phpinfo script and see what your mysql directives are set at, specifically: mysql.allow_persistent, mysql.max_persistent, and mysql.max_links. Also are you using mysql_connect, or mysql_pconnect?
     
    jestep, Jun 19, 2008 IP
  5. ssanders82

    ssanders82 Peon

    Messages:
    77
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks guys, I actually figured this one out from the error email, which included phpinfo() information.

    I went back and scrutinized it and did a double-take when I looked at the server IP - it's from Mosso, where I had an account but canceled last week after moving to my new server. The old server was sending me error emails.

    The domain name has propagated, so I don't know *how* it's still running scripts. I think someone linked to a forum post or something (but not by IP, the URI was the domain name...) and it was still pointing to the old server somehow so all my tweaking on the new server affected nothing, haha. Well, you live and learn. Good lord, what a mess.
     
    ssanders82, Jun 19, 2008 IP