Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1835 Malformed communication packet

OJS was down for us this morning due to a bug in MariaDB rolled out last night. I was able to resolve it by upgrading PHP to 7.3 and thought I would share with other users. Below is the error message I found for OJS; then I discovered other sites on our server were also having similar SQL issues. Here is the bug:

https://jira.mariadb.org/browse/MDEV-24121?focusedCommentId=171262&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-171262

  • Application Version - OJS 3.2.1.1
  • Description of issue
    White Screen of Death once logged in
  • Error log messages

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1835 Malformed communication packet in /home/username/public_html/ojs/lib/pkp/lib/vendor/illuminate/database/Connectors/MySqlConnector.php:57 Stack trace:
#0 /home/username/public_html/ojs/lib/pkp/lib/vendor/illuminate/database/Connectors/MySqlConnector.php(57): PDOStatement->execute()
#1 /home/username/public_html/ojs/lib/pkp/lib/vendor/illuminate/database/Connectors/MySqlConnector.php(30): Illuminate\Database\Connectors\MySqlConnector->configureEncoding(Object(PDO), Array)
#2 /home/username/public_html/ojs/lib/pkp/lib/vendor/illuminate/database/Connectors/ConnectionFactory.php(182): Illuminate\Database\Connectors\MySqlConnector->connect(Array) #3 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors{closure}()
#4 /home/username/public_html/ojs/lib/pkp/lib/vendor/illuminate/database/Connection.php(919): call_user_func(Object(Closure))
#5 /home/username/public_html/ojs/lib/pkp/lib/vendor/illuminate/database/Conne in /home/username/public_html/ojs/lib/pkp/lib/vendor/illuminate/database/Connection.php on line 664

$ php --version
PHP 7.2.34 (cli) (built: Nov 4 2020 16:01:29) ( NTS )

$ mysql -V
mysql Ver 15.1 Distrib 10.2.34-MariaDB, for Linux (x86_64) using readline 5.1

Used WHM to update this domain to PHP 7.3.

Hi @maifeld,

I think this is between your PHP PDO library and MySQL; it’s below the level of OJS. It may be something like a client library incompatibility between the client compiled into your PHP (or loaded as a library) and the server-side library. (On a live server, if these are updated using a package manager, it might be necessary to restart both the DBMS and the web server of PHP instance pool in order for the libraries to be reloaded with new versions.)

Regards,
Alec Smecher
Public Knowledge Project Team

Yes, the fault is a MariaDB bug in the top link. Since my users complained “OJS doesn’t work”, I started here. I soon found out more than just OJS was failing - other sites on the same server were as well.
I thought this info could be useful today as other admins may be getting the same complaint if they also use MariaDB and PHP<7.3. For me, updating to PHP 7.3 was all it took. This posting wasn’t a complaint about OJS, just attempting to share a finding.

4 Likes

Hi, I have the same problem. However, upgrading to PHP 7.3 raised me this error:

[13-Mar-2021 20:02:26 UTC] PHP Fatal error: Uncaught Error: Call to undefined function PKP\Services\json_decode() in /home/denqgtqu/public_html/ojs/lib/pkp/classes/services/PKPSchemaService.inc.php:56
Stack trace:
#0 /home/denqgtqu/public_html/ojs/lib/pkp/classes/site/SiteDAO.inc.php(62): PKP\Services\PKPSchemaService->get(‘site’)
#1 /home/denqgtqu/public_html/ojs/lib/pkp/classes/site/SiteDAO.inc.php(42): SiteDAO->_fromRow(Array)
#2 /home/denqgtqu/public_html/ojs/lib/pkp/classes/core/PKPRequest.inc.php(490): SiteDAO->getSite()
#3 /home/denqgtqu/public_html/ojs/classes/i18n/AppLocale.inc.php(78): PKPRequest->getSite()
#4 /home/denqgtqu/public_html/ojs/lib/pkp/classes/i18n/PKPLocale.inc.php(140): AppLocale::getLocale()
#5 /home/denqgtqu/public_html/ojs/lib/pkp/classes/core/Dispatcher.inc.php(131): PKPLocale::initialize(Object(Request))
#6 /home/denqgtqu/public_html/ojs/lib/pkp/classes/core/PKPApplication.inc.php(281): Dispatcher->dispatch(Object(Request))
#7 /home/denqgtqu/public_html/ojs/index.php(68): PKPApplication->execute()
#8 {main}
thrown in /home/denqgtqu/public_html/ojs/lib/pkp/classes/services/PKPSchemaService.inc.php on line 56

Hi @sina,

According to the message, I’d say that php-json extension isn’t installed or enabled, e.g.: https://stackoverflow.com/a/18239665/6711224