[OJS 3.3.0.13] PHP errors

HI,

For several days now I have been getting some errors in PHP, which I don’t know why they appear and they are making my OJS 3.3.0.13 installation a little slow. I have php 7.4 installed

[Wed Nov 08 14:51:18.711407 2023] [php7:error] [pid 1448279] [client 47.128.39.54:48648] PHP Fatal error:  Uncaught InvalidArgumentException: Passed value cannot be an array in lib/pkp/lib/vendor/danielstjules/stringy/src/Stringy.php:45\nStack trace:\n#0 lib/pkp/lib/vendor/danielstjules/stringy/src/Stringy.php(73): Stringy\\Stringy->__construct(Array, NULL)\n#1 lib/pkp/classes/core/PKPString.inc.php(160): Stringy\\Stringy::create(Array)\n#2 cache/t_compile/636c2e7eaf78ae663eb6e72e7568dda0f88b6f93^c2055d14f27582f3361894f4184ce1a4c0497385_0.app.frontendpagessearchAuthor.php(58): PKPString::substr(Array, 0, 1)\n#3 lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_654aa2ef499d20_90336699(Object(Smarty_Internal_Template))\n#4 lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRen in lib/pkp/lib/vendor/danielstjules/stringy/src/Stringy.php on line 45
[Wed Nov 08 14:51:23.996203 2023] [php7:error] [pid 1455976] [client 47.128.35.237:50200] PHP Fatal error:  Uncaught Error: Call to a member function getPublished() on null in cache/t_compile/ad8495e4b9ac5b46519f7e408bb2c0f8a8ac0eb3^acf1fc671fe3149386beb488bd42d95154e9d6f3_0.app.frontendpagessearchAuthor.php:49\nStack trace:\n#0 lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_654aa2ec81aa01_67539578(Object(Smarty_Internal_Template))\n#1 lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))\n#2 lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))\n#3 lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->r in cache/t_compile/ad8495e4b9ac5b46519f7e408bb2c0f8a8ac0eb3^acf1fc671fe3149386beb488bd42d95154e9d6f3_0.app.frontendpagessearchAuthor.php on line 49

Hi @rcgillis, @asmecher,

Could you help me with this problem?

Hi @diegomejia07,

You’re running into googleSearch report a lot of slowpages linking to author's search · Issue #7183 · pkp/pkp-lib · GitHub; I’d suggest updating to the latest 3.3.0-x release.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

But I have version 3.3.0.13 unattacked and at the moment we do not plan to update. Is there a patch or solution that I can apply to my installation to solve these errors.

Hi @diegomejia07,

The patch for stable-3_3_0 is available here, but if you want a quick way to block access to those functions, just make the change to pages/search/index.php from that patch.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I applied the patch that you mentioned to me and I no longer see these errors, but now they are showing me the following:

PHP Fatal error:  Uncaught PDOException: SQLSTATE[08004] [1040] Too many connections in
/lib/pkp/lib/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:38\nStack trace:\n#0
 /lib/pkp/lib/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(38):
 PDO->__construct('mysql:host=xxxxx...', 'dbxxxxxxxx', 'xxxxxxxxxL', Array)\n#1
/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(67):
Doctrine\\DBAL\\Driver\\PDOConnection->__construct('mysql:host=xxxxx...', 'dbxxxxxxxx', 'xxxxxxxxxL', Array)\n#2
/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(46):
Illuminate\\Database\\Connectors\\Connector->createPdoConnection('mysql:host=xxxxx...', 'dbxxxxxxxx', 'xxxxxxxxxL', Array)\n#3
/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlCon
in /lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 671
PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [2002] Resource temporarily unavailable in
/lib/pkp/lib/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:38\nStack trace:\n#0
 /lib/pkp/lib/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(38):
 PDO->__construct('mysql:host=xxxxx...', 'dbxxxxxxxx', 'xxxxxxxxxL', Array)\n#1
/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(67):
Doctrine\\DBAL\\Driver\\PDOConnection->__construct('mysql:host=xxxxx...', 'dbxxxxxxxx', 'xxxxxxxxxL', Array)\n#2
/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(46):
 Illuminate\\Database\\Connectors\\Connector->createPdoConnection('mysql:host=xxxxx...', 'dbxxxxxxxx', 'xxxxxxxxxL', Array)\n#3
/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connect
in /lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 671
PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [2002] Connection refused in 
/lib/pkp/lib/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:38\nStack trace:\n#0 
/lib/pkp/lib/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(38): 
PDO->__construct('mysql:host=xxxxx...', 'dbxxxxxxxx', 'xxxxxxxxxL', Array)\n#1 
/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(67): 
Doctrine\\DBAL\\Driver\\PDOConnection->__construct('mysql:host=xxxxx...', 'dbxxxxxxxx', 'xxxxxxxxxL', Array)\n#2 
/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(100): 
Illuminate\\Database\\Connectors\\Connector->createPdoConnection('mysql:host=xxxxx...', 'dbxxxxxxxx', 'xxxxxxxxxL', Array)\n#3 
/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector in 
/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 671

Can you help me know what’s going on there?

Hi @diegomejia07,

I’d suggest checking your access log to see if you’re getting hit by indexes at a high rate. If so, you might want to use robots.txt to throttle them back. Otherwise, maybe your MySQL configuration has a low concurrent client limit?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

It is very strange since for a few weeks I have been experiencing this disconnection to the database and it causes MySQL to crash, and it only happens in the early morning hours. I don’t know if there are some processes or scheduled tasks that run within the platform and that cause there to be many processes and many requests at the same time within MySQL and that this is the possible cause.

Hi @diegomejia07,

I think investigating your access log will help! It sounds to me like an indexing activity gone amok.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

But I don’t know what I can look for in the access.log or error.log of the server. Could you give me help about what errors or what I should look for to find the indexing problem you mention?

Hi @diegomejia07,

Look in your access log for entries made in the ~10 minutes before the server started reporting problems. If there is an indexing operation that’s causing the server to go down, it probably won’t be subtle; you’ll see hundreds of hits from the same source/referrer/IP address.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I was checking the errors and I see that before the MySQL crashes, there are many processes that say:

ojs2: 404 Not Found, referer: https://xxxxxxx/index.php/xxxx/search/search?query=searchPage=135

And then the MySQL crashes because:

Active: failed (Result: oom-kill)
nov 19 17:21:50 systemd[1]: mariadb.service: A process of this unit has been killed by the OOM killer.
nov 19 17:21:51 systemd[1]: mariadb.service: Main process exited, code=killed, status=9/KILL
nov 19 17:21:51 systemd[1]: mariadb.service: Failed with result 'oom-kill'.

Hi @diegomejia07,

Your server ran out of memory, likely because MariaDB was consuming it all. If possible, one solution would be simply to increase the amount of memory available.

That does suggest indexer / bot activity. But check the access log (as opposed to the error log) for URLs like the one quoted above – the error log will only show errors, but the access log will show you the volume of requests that may be getting served correctly, but may be bogging down the server in the process.

There are other server-side tools you might want to try – MariaDB’s slow query log, for example, which could identify problematic SQL queries.

These are general web app / server tuning issues, so you might also browse around StackOverflow.

Regards,
Alec Smecher
Public Knowledge Project Team

This topic was automatically closed after 9 days. New replies are no longer allowed.