• Resolved barnez

    (@pidengmor)


    Hi, recently I’m seeing the following entry in the error log of a site that is being logged every few days. Here is an example of the most recent entry:

    [16-Jan-2024 00:59:16 UTC] PHP Fatal error: Uncaught mysqli_sql_exception: Too many connections in /home/xxxx/xxxx.com/wp-content/plugins/ninjafirewall/lib/firewall.php:439
    Stack trace: 0 /home/xxxx/xxxx.com/wp-content/plugins/ninjafirewall/lib/firewall.php(439): mysqli_real_connect(Object(mysqli), 'localhost', 'xxxx_xxxx…', Object(SensitiveParameterValue), 'xxxx_xxxx…', NULL, NULL, 0) 1 /home/xxxx/xxxx.com/wp-content/plugins/ninjafirewall/lib/firewall.php(93): nfw_connect() 2 /home/xxxx/xxxx.com/wp-content/nfwlog/ninjafirewall.php(10): include_once('/home/xxxx/…') 3 {main}`[16-Jan-2024 00:59:16 UTC] PHP Fatal error: Uncaught mysqli_sql_exception: Too many connections in /home/xxxx/xxxx.com/wp-content/plugins/ninjafirewall/lib/firewall.php:439
    Stack trace: 0 /home/xxxx/xxxx.com/wp-content/plugins/ninjafirewall/lib/firewall.php(439): mysqli_real_connect(Object(mysqli), 'localhost', 'xxxx_xxxx…', Object(SensitiveParameterValue), 'xxxx_xxxx…', NULL, NULL, 0) 1 /home/xxxx/xxxx.com/wp-content/plugins/ninjafirewall/lib/firewall.php(93): nfw_connect() 2 /home/xxxx/xxxx.com/wp-content/nfwlog/ninjafirewall.php(10): include_once('/home/xxxx/…') 3 {main}

    thrown in /home/xxxx/xxxx.com/wp-content/plugins/ninjafirewall/lib/firewall.php on line 439

    The line of code in /lib/firewall.php is:

    @mysqli_real_connect( $nfw_['mysqli'], $nfw_['DB_HOST'], $nfw_['DB_USER'], $nfw_['DB_PASSWORD'], $nfw_['DB_NAME'], $nfw_['port'], $nfw_['socket'], $nfw_['MYSQL_CLIENT_FLAGS'] );

    Any thoughts on what might be causing this?

    * There are three sites on the same server, two sites are logging this error, and one is not. All site use the same theme. In terms of the plugins, the two sites throwing the error have three plugins activated that are not present on the third site:

    • This topic was modified 10 months, 2 weeks ago by barnez. Reason: Added details regarding the plugins and theme

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author nintechnet

    (@nintechnet)

    Can you check your HTTP server logs and see what happened on “16-Jan-2024 00:59:16 UTC” ? It looks like you had too many concurrent connections. That would be easy to see in the log. It could be, for instance, a surge in traffic, or a crawler sending too many HTTP requests.

    • This reply was modified 10 months, 1 week ago by nintechnet.
    Thread Starter barnez

    (@pidengmor)

    These are the logs leading up to that 00:59:16:

    94.156.65.168 - - [16/Jan/2024:00:59:03 +0000] "GET /wordpress HTTP/1.1" 500 1101 "-" "-"
    94.156.65.168 - - [16/Jan/2024:00:59:07 +0000] "GET /wordpress HTTP/1.1" 500 1101 "-" "-"
    xxx.xxx.xxx.xx - - [16/Jan/2024:00:59:12 +0000] "POST /wp-cron.php?doing_wp_cron=1705366752.5011439323425292968750 HTTP/1.1" 200 0 "-" "WordPress/6.4.2; https://www.xxxx.com"
    94.156.65.168 - - [16/Jan/2024:00:59:12 +0000] "GET /wordpress HTTP/1.1" 500 0 "-" "-"
    94.156.65.168 - - [16/Jan/2024:00:59:15 +0000] "GET /wp HTTP/1.1" 500 0 "-" "-"
    94.156.65.168 - - [16/Jan/2024:00:59:17 +0000] "GET /wp-admin/install.php HTTP/1.1" 403 384 "-" "-"
    94.156.65.168 - - [16/Jan/2024:00:59:17 +0000] "GET /blog HTTP/1.1" 301 0 "-" "-"

    Doesn’t look like the connections are too hectic …

    Plugin Author nintechnet

    (@nintechnet)

    Can you check your database max_connections value? Maybe it needs to be increased.

    Thread Starter barnez

    (@pidengmor)

    Thanks for getting back. The max_connections value is set at 500</code>.

    Plugin Author nintechnet

    (@nintechnet)

    500 is usually enough.
    Is there any other sites or running application on the server that need to connect to the DB?

    Do you have any tools to monitor the DB (e.g., munin-node etc) ?

    Thread Starter barnez

    (@pidengmor)

    This is the only site connected to the database. Only WordPress connects to it.

    The site is running on a shared server. Would the Query Monitor plugin be worth installing to see what’s happening when the error throws again?

    Plugin Author nintechnet

    (@nintechnet)

    You can try the Query Monitor plugin indeed, but as that is a shared server, I would contact the host to see if there was any problem with the DB, they could access the logs and see what’s going on. 500 connections is a lot.

    Thread Starter barnez

    (@pidengmor)

    Thanks for the advice. I’ll follow this up with the host.

    Thread Starter barnez

    (@pidengmor)

    Just to update:

    I needed to do a table repair about 4 weeks ago after the site crashed with the following error logged: Table './xxxx_xxxx/wp_options' is marked as crashed and should be repaired in .... I repaired the wp_options table, where the number of rows was changed from 1321 to 1319. Since then, there have been no further errors logged.

    I’m marking this as resolved. Thanks again for your help!

    • This reply was modified 9 months, 1 week ago by barnez. Reason: formatting
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Uncaught mysqli_sql_exception: Too many connections i’ is closed to new replies.