Errors: "Maximum execution time of 300 seconds exceeded" - Subs-Db-postgres.php

Started by juedan, February 01, 2021, 01:54:48 PM

Previous topic - Next topic

juedan

Hello Forum, hello developers,

after setting up SMF 2.0.17 and doing some administration tasks I found many errors like these:
[Mon Feb 01 10:13:12.210022 2021] [php7:error] [pid 69504] [client 82.113.106.93:14509] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in <vhost-path>/htdocs/Sources/Subs-Db-postgresql.php on line 390, referer: https://<domain.tld/

When I look in the script code I find this endless loop:
while (true)
{
$pos1 = strpos($db_string, '\'', $pos + 1);
$pos2 = strpos($db_string, '\\', $pos + 1);
if ($pos1 === false)
break;
elseif ($pos2 == false || $pos2 > $pos1)
{
$pos = $pos1;
break;
}
$pos = $pos2 + 1;
}



How to solve this problem?
I'm running SMF 2.0.17 on FreeBSD 11.4, PHP 7.4 and PostgreSQL 12.2

Best regards

JueDan

Kindred

well, not sure about the error itself, but 2.0.17 does not support php 7.4
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

shawnb61

Kindred is correct, need to drop the php version.

To be honest, we have extremely few pg users on 2.0, but it works fine in my testing on pg10. 

I doubt we have any pg users on 12...  This may be new territory here...

A couple of other notes that may help:

1) From the install requirements, make sure you have standard_conforming_strings off:
QuotePostgreSQL 8.0 or higher (standard_conforming_strings must be set to off, starting from PostgreSQL 9.1 default is on)
https://wiki.simplemachines.org/smf/SMF2.0:Requirements_and_recommendations

2) You need to tell pg that SMF is already UTF8 compliant, by changing two settings.  Yes, this needs to be done by hand for pg in 2.0.  In settings.php, add the following line (if not already there):
$db_character_set = 'utf8';

In the smf_settings table, add the following entry (if not already there):
variable: global_character_set
value: UTF-8

3) That logic is standard query-cleansing (strips whitespace) & has been used by both mysql & pg since, forever... 

If the above steps do not fix the problem, I believe that particular check will be disabled if you set the following in the smf_settings table:
variable: disableQueryCheck
value: 1

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

albertlast

smf 2.1 got
instead of

elseif ($pos2 == false || $pos2 > $pos1)



elseif ($pos2 === false || $pos2 > $pos1)


duno if this would do the trick.

also smf 2.1 got many pg optimization.

juedan

Thanks to all.
The tip from albertlast solved the problem.

Best regards
JueDan

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: