Persistent session and database errors

We’ve been getting the following errors multiple times daily.

[04-May-2023 09:31:46 UTC] PHP Fatal error:  Uncaught Zend_Db_Adapter_Mysqli_Exception: Connection refused in /application/libraries/Zend/Db/Adapter/Mysqli.php:340
Stack trace:
#0 /application/libraries/Zend/Db/Adapter/Abstract.php(861): Zend_Db_Adapter_Mysqli->_connect()
#1 /application/libraries/Zend/Db/Adapter/Abstract.php(931): Zend_Db_Adapter_Abstract->quote('3c70c8873448d4a...', 'varchar')
#2 /application/libraries/Zend/Db/Table/Abstract.php(1345): Zend_Db_Adapter_Abstract->quoteInto('`omek_sessions`...', '3c70c8873448d4a...', 'varchar')
#3 /application/libraries/Zend/Session/SaveHandler/DbTable.php(345): Zend_Db_Table_Abstract->find('3c70c8873448d4a...')
#4 /application/libraries/Omeka/Session/SaveHandler/DbTable.php(102): Zend_Session_SaveHandler_DbTable->write('3c70c8873448d4a...', Arr in /application/libraries/Zend/Db/Adapter/Mysqli.php on line 340
[04-May-2023 09:31:47 UTC] Omeka fatal error: Connection refused.

Confirm that the information in your db.ini file is correct.

We’re hosted by Reclaim and we’ve been working with them to find the source of the errors. I created a test version of the site (with the same plugins, theme, and configuration but a different db) on another server and I’m not getting these errors there. There may be a plugin incompatibility that I haven’t found. I really don’t know what to try next, and I’d very much appreciate advice.

Other potentially useful info:

  • collection of 35k items

  • last year the site was migrated from one Reclaim server to another and upgraded from 2.7.1 to 3.0.3. The errors began then and have become more frequent since

Here’s our plugin stack:
Bulk Metadata Editor
Collection Tree
Commenting
Curator Monitor (custom)
Default Search Options
Dublin Core Extended
Exhibit Builder
Geolocation
Hide Elements
History Log
Item Relations Plus (custom)
JAPP Specific (custom)
Redact Elements
Reference
Reports
Search By Metadata
Simple Pages
Simple Vocab
Sitemap 2

“Connection refused” here is coming from the database server your site is running on.

Does Reclaim have anything to say about this? Logs from MySQL? What the load looks like? If you have a lot of traffic so that there are lots of open MySQL connections you could get this error, for example.

Reclaim recommended making sure our theme and plugins are up to date. I’ve updated the plugins, toggled plugins on and off, and tested the plugins and theme on a different server. I’m not ruling out plugin incompatibility. It’s possible I just haven’t found the problem in a plugin yet. But I’m not able to replicate the errors on another server.

The logged errors in themselves are not so much a problem. But the site frequently goes down as our staff create and edit items. It’s this interruption (on the public facing site and in the dashboard) that’s the problem.

I’m not sure what to try next. Reclaim is offering to migrate the site to a different shared server.

Since you’re on shared hosting, it’s possible that this issue is just the server being kind of “full,” or it might be something actually to do with your site. Really only looking at the MySQL server is likely to shine light on what’s happening here, how many connections are open when this happens, what those connections are doing, what customer(s) they’re from. And just information in general about whether this problem is just happening to you or other tenants on that server.

The errors you show there look like two consecutive requests close in time getting “refused,” from two different internal Omeka systems. To me that points to the database server using up all its available connections as the most likely culprit. Whether or not it’s your site that’s creating that situation, it’s impossible to tell with this information.

Anyway, it might be worth looking at migration to another server if that’s what’s being offered, if for no other reason than to rule out a possible source of the problem.

Thanks @jflatnes

Reclaim migrated the site to a different shared server and the disruptions related to these errors stopped.