WordPress.org

Ready to get started?Download WordPress

Forums

Wordfence Security
[resolved] Too Many MySQL connections (12 posts)

  1. LimeCanvas
    Member
    Posted 1 year ago #

    Our ISP has detected a huge amount of MySQL errors being generated by the Wordfence plugin.

    So many in fact that they have asked us to remove it as our error file has racked up to 12MB in under 2 hours.

    Here's a sample of the error messages:
    [Thu Nov 29 03:03:36 2012] [error] [client 107.21.*.*] PHP Warning: mysql_connect() [function.mysql-connect]: User [removed] already has more than 'max_user_connections' active connections in /home/sites/[removed]/public_html/wp-content/plugins/wordfence/lib/wfDB.php on line 56

    [Thu Nov 29 03:03:36 2012] [error] [client 107.21.*.*] PHP Warning: mysql_ping() expects parameter 1 to be resource, boolean given in /home/sites/[removed]/public_html/wp-content/plugins/wordfence/lib/wfDB.php on line 48

    That goes on pretty much every few tenths of a second.

    Are the MySQL connecitons being closed and managed properly in your private function connectHandle() method?

    How many times are you calling mysql? You also seem to be using mysql_ping which even PHP discourages use of.

    Why do you need to make so many mysql connections? What info are you reading/writing to the DB?

    Can't you use WP Transients for that?

    Cheerz,
    Wil.

    http://wordpress.org/extend/plugins/wordfence/

  2. Wordfence
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Wil,

    Wordfence makes it's own connection to the DB and hosts that have "max_user_connections" set very low see this issue.

    Tell your host to increase "max_user_connections" and try again.

    We use our own connection because it gives us higher performance than using wpdb.

    Transients are for caching.

    Regards,

    Mark.

  3. LimeCanvas
    Member
    Posted 1 year ago #

    Thanks for the response @mmaunder

    We're on shared hosting for this particular site so I have no control over the max_user_connection and they won't increase it.

    About transients, I was just wondering if you could use them to store some info rather than polling the DB.

    Any-ho, here's the warnings from the server error log. At the very least they should help you put in some more error catching.

    [Thu Nov 29 03:03:36 2012] [error] [client ***.***.***.***] PHP Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/sites/***.com/public_html/wp-content/plugins/wordfence/lib/wfDB.php on line 57

    [Thu Nov 29 03:03:36 2012] [error] [client ***.***.***.***] PHP Warning: mysql_ping() expects parameter 1 to be resource, boolean given in /home/sites/***.com/public_html/wp-content/plugins/wordfence/lib/wfDB.php on line 48

    Cheerz,
    Wil.

  4. LimeCanvas
    Member
    Posted 1 year ago #

    @mmaunder can you suggest a minimum max_user_connections setting to use with your plugin?

  5. LimeCanvas
    Member
    Posted 1 year ago #

    Our host has come back with their setting of max_user_connections=25.

    They will not change this.

  6. Robert Cadar
    Member
    Posted 1 year ago #

    Why this post have status resolved, i hav ethe same problem, and i can' increase number of connections, what should i do in this case ?

  7. esmi
    Forum Moderator
    Posted 1 year ago #

  8. LimeCanvas
    Member
    Posted 1 year ago #

    @esmi - why post a new topic when the Plugin Author wrongly resolved an unresolved thread?

  9. Robert Cadar
    Member
    Posted 1 year ago #

    The observation it's corect ...the problem it's not resolved !

  10. esmi
    Forum Moderator
    Posted 1 year ago #

    Are you using the same version of WordPress on the same physical server hosted by the same hosts with the same plugins, theme & configurations as the original poster?

    No? Then your problem - despite any similarity in symptoms - is likely to be completely different. So please help us to help you and post a new topic when we ask you to.

  11. LimeCanvas
    Member
    Posted 1 year ago #

    @esmi - could you use your moderator powers to mark this thread as unresolved?

  12. esmi
    Forum Moderator
    Posted 1 year ago #

    Sorry but no. If you didn't mark this topic as resolved then the plugin author must have done so. And I am not willing to over-ride his decision. If you are still having problems, I suggest you open a new topic.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.