Is MailPoet making multiple concurrent MySQL connections?
-
Firstly, thanks for MailPoet. I tried a lot of options for creating an automated post notification newsletter before settling on MailPoet. However, I have a problem which I suspect it may be causing:
I have a number of low-traffic sites on shared servers with Bluehost and Hostgator, all of which have been plagued for a long time by intermittent database connection errors that appear to be triggered by WordPress exceeding the host’s maximum of 25 simultaneous MySQL connections.
These sites work fine most of the time, so I know the problem isn’t the DB_… settings in wp-config.php. Normally I get the intermittent database connection error messages when navigating in the WordPress backend, doing typical operations such as creating new posts or approving and responding to comments. This is annoying, but occasionally I (and presumably my site visitors) also see them on the front end; which is really bad.
All the sites have a similar collection of plugins, including caching plugins that should reduce database activity, and they don’t get enough traffic to ever have anything like 25 simultaneous visitors. My attempts to resolve the issue with each company’s online support so far have been unsuccessful, and switching hosting providers hasn’t solved it either.
I also get intermittent messages in the WordPress backend saying that MailPoet has failed to connect to the database, pointing me to the MailPoet knowledgebase article Solving Database Connection Issues. Implementing the solutions in the article doesn’t solve the problem; MailPoet can connect to the database OK, just not all the time.
However, the article makes me suspect that MailPoet may be the culprit behind the intermittent database connection errors I’m getting in WordPress generally. I’m not a PHP/mySQL guru but I don’t understand why MailPoet isn’t using the $wpdb class to access the database using the existing WordPress MySQL connection.
On one site I usually only make monthly posts, so I tried disabling MailPoet between them, and got no errors all month while approving and responding to comments, which would normally trigger the intermittent error.
I reenabled MailPoet prior to publishing this month’s post so that the plugin could send it out the Post Notification newsletter with this month’s post, and immediately got the intermittent database connection error messages again while creating the post.
I also got this error message emailed to me immediately after posting the new article, also showing that MailPoet’s attempts to connect to the database are sometimes failing:
WordPress version 5.7.2
Current theme: Hestia (version 3.0.16)
Current plugin: MailPoet 3 (New) (version 3.64.2)
PHP version 7.4.20Error Details
=============
An error of type E_ERROR was caused in line 2 of the file /home4/…/cfs-survivors.org/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php. Error message: Uncaught PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in /home4/…/cfs-survivors.org/wp-content/plugins/mailpoet/lib/Doctrine/Driver/PDOStatement.php:88
Stack trace:
#0 /home4/…/cfs-survivors.org/wp-content/plugins/mailpoet/lib/Doctrine/Driver/PDOStatement.php(88): PDOStatement->execute(NULL)
#1 /home4/…/cfs-survivors.org/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(2): MailPoet\Doctrine\Driver\PDOStatement->execute()
#2 /home4/…/cfs-survivors.org/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php(2): MailPoetVendor\Doctrine\DBAL\Connection->executeQuery(‘SELECT w0_.hash…’, Array, Array, NULL)
#3 /home4/…/cfs-survivors.org/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Query.php(2): MailPoetVendor\Doctrine\ORM\Query\Exec\SingleSelectExecutor->execute(Object(MailPoet\Doctrine\SerializableConnection), Array, Array)
#4Is it possible that MailPoet is opening multiple concurrent MySQL connections that are exceeding my host’s simultaneous MySQL connection limit? If so, how can I get it to use WordPress’s existing database connection instead?
Thanks,
Graham
- The topic ‘Is MailPoet making multiple concurrent MySQL connections?’ is closed to new replies.