Advertisement:

Author Topic: Errors: "Maximum execution time of 300 seconds exceeded" - Subs-Db-postgres.php  (Read 1435 times)

Offline juedan

  • Newbie
  • *
  • Posts: 2
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:
Code: [Select]
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

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 60,235
  • Gender: Male
    • Kindred-999 on GitHub
well, not sure about the error itself, but 2.0.17 does not support php 7.4
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."

Offline shawnb61

  • Dev. Team Mentor
  • Developer
  • SMF Hero
  • *
  • Posts: 3,119
    • sbulen on GitHub
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:
Quote
PostgreSQL 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

Offline albertlast

  • Development Contributor
  • Full Member
  • *
  • Posts: 644
smf 2.1 got
instead of
Code: [Select]
elseif ($pos2 == false || $pos2 > $pos1)

Code: [Select]
elseif ($pos2 === false || $pos2 > $pos1)

duno if this would do the trick.

also smf 2.1 got many pg optimization.

Offline juedan

  • Newbie
  • *
  • Posts: 2
Thanks to all.
The tip from albertlast solved the problem.

Best regards
JueDan

Online vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,480
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Nice, good to know!
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