MYSQL Error on signup:

Discussion in 'Troubleshooting' started by sda100175, Aug 27, 2008.

  1. sda100175

    sda100175 New Member

    Joined:
    Mar 25, 2008
    Messages:
    12
    User puts in CC info, hits Subscribe, then browser waits... and waits... then the "An Error has Occurred" page comes up with this message overlapping itself in red:

    MYSQL ERROR:
    MySQL server has gone away
    in query:
    INSERT INTO amember_error_log (member_id, time, remote_addr, url, referrer, error) VALUES (NULL, NOW(), '38.112.9.230', '/amember/plugins/payment/cc_core/cc.php', 'https://www.magicdiligence.com/amember/plugins/payment/cc_core/cc.php?action=mfp&payment_id=362&member_id=218&v=5e83eec7e8964cea7b29c5b233512ad1', 'MYSQL ERROR:
    Lost connection to MySQL server during query
    in query:
    SELECT\r\n p.*, m.login as member_login,\r\n pr.title as product_title\r\n FROM amember_payments p\r\n LEFT JOIN amember_members m USING (member_id)\r\n LEFT JOIN amember_products pr ON (p.product_id = pr.product_id)\r\n WHERE\r\n p.payment_id = 362\r\n ')

    Now, Amember support tells me it's a hosting problem. Hosting tells me it's a problem with an inefficient query. I'm stuck between all this finger pointing losing business.

    My host is GoDaddy. I have not had any problems before this week. They tell me the DB loads are fine. I have not had trouble with the DB on the content side. Is there any alternative way to handle these payments, or improve the queries, etc?

    Thanks for any help.
  2. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    Is this a new install or an existing site. How many products / users do you have?

    I tend to agree with Amember support on this one. Godaddy is famous for overselling / underpowering shared hosting accounts ( you get what you pay for )

    That being said:

    1) What is your configuration of your DB?
    2) What version of MYSQL support did you select when you set up your account?
    3) Do you only see this with CC payments?
    4) If you create a "Free" product do you also see this issue?
  3. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    Is this a brand new site? May be worth switching over to hostgator or other host thats more amember friendly.

    David
  4. sda100175

    sda100175 New Member

    Joined:
    Mar 25, 2008
    Messages:
    12
    Thanks for the replies guys.

    My site is about 4 months old, I have about 135 users. It's not a big DB.

    1) What setting exactly? It's the vanilla set-up. GoDaddy doesn't allow you change things like the wait_timeout.

    2) I have the shared hosting account support.

    3+4) Yes. Free signups work fine. And test mode works fine (I use Authorize.net AIM). And even CC's work fine... occasionally! It looks like Amember might be keeping a DB connection open during the payment process? This could time it out.

    What is the best hosting to use with Amember? I'm not shy about transitioning the site, especially since I realized today I've lost a number of customers over the past few month without even knowing it.

    Thanks
  5. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    With that size of a database I can't anticipate any resource constraints from Amember specifically. Obviously you can go into PHPMyAdmin and Optimize, but I suspect there is little value at this stage.

    1) If I remember correctly the last time I played with GoDaddy they let me select the version of MySQL when setting up the DB, that is what I was referring to.

    Just about any host provider should work, finding a shared provider that does not overload is the key at this stage for you.

    I have had good luck with MDD Hosting
  6. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
  7. jbround39

    jbround39 aMember Pro Customer

    Joined:
    Mar 20, 2008
    Messages:
    61
    Hey guys, I'm suddenly having the exact same problem.

    Whenever someone registers (or tries to pay for a product), it freezes and they get the:

    MYSQL ERROR:
    MySQL server has gone away
    in query:


    This happens on various queries, but it's usually something as benign as select * from amember_members where member_id=12345

    I spent an hour on the phone with my host (hostmonster) who has always been very good. They say it is a script problem causing a timeout, typically because of a persistent connection.

    I've never had this problem before, and I haven't changed anything in my script. I've used it for a year and have about 15K members.

    Note that it freezes after registering them - the information ends up in the database. But it never gets to the point where it emails them with their user info, nor does it pull up the member page.

    Any suggestions?
  8. jbround39

    jbround39 aMember Pro Customer

    Joined:
    Mar 20, 2008
    Messages:
    61
    For anyone else who has this problem:

    If you have a large number of members, this could happen to you.

    Alex was able to fix it for me, here's what he did:
    This worked for me because I don't use .htpasswd to protect anything. Hope this will help anyone else with the same problem.

    As usual, Alex and the rest of these guys are great. Less than 24 hours to a solution almost every time.
    tokazama2 likes this.
  9. codeispoetry

    codeispoetry aMember Pro Customer

    Joined:
    Jan 12, 2009
    Messages:
    336
    Fantastic share, jbround39!

    Lee
  10. fadi

    fadi New Member

    Joined:
    Nov 22, 2008
    Messages:
    30
    I am getting same error all of a sudden. Funny thing is that my blog and forum run fast, very responsive. aMember extremely slow and from time to time throws the error when trying to access the members page. It is slow on all its pages. This is not write operation, it is read but the error is thrown trying to write to access_log table. It throws second error trying to write that error to the error_log table.

    forum, blog, and amember using the same server, different databases so it is not a server. There are only test users on it, so it is not loaded.

    Disabled the plugins, still same issue. I will leave it alone for tonight to see if it is something else, but so far, this is very flaky. It doesnt always copy the login cookies, it throws errors, runs slow... I am starting to consider switching to another membership software due to the pain in getting this thing running correctly.

    Hostgator, PHP 5, MySQL 5.1.2...
  11. fadi

    fadi New Member

    Joined:
    Nov 22, 2008
    Messages:
    30
    Hey guys, found the issue and temp solution for this problem. Wrote to Alex about it and he may incorporate a better perm solution.

    in mysql.inc.php in log_access function, the code calls gethostbyaddr method. googling it, looks like it is known to cause timeouts and can take long time to execute...

    PHP:
            if (preg_match('/proxy\.aol\.com$/'gethostbyaddr($REMOTE_ADDR)))
                return;
    Commenting those two lines
    PHP:
    //        if (preg_match('/proxy\.aol\.com$/', gethostbyaddr($REMOTE_ADDR)))
    //            return;
    Made the application run like a charm.... be warned however, there are some billing plug-ins that use gethostbyaddr as well, so if you are using any of these payment systems, your users may get timeouts as well signing up.

    Hope this helps

Share This Page