Page 1 of 2

Search timeout.

Posted: Mon Sep 18, 2017 11:45 pm
by NomadThanatos
My forums search for some keywords will be timeout.

Timeout result
https://frt-eve.com/search.php?keywords=bilibili
https://frt-eve.com/search.php?keywords=Discord
...

Normal result
https://frt-eve.com/search.php?keywords=bilibi => for empty result
https://frt-eve.com/search.php?keywords=EVE => for non-empty result
...

First I checked the nginx log.
And I found the reason I got 500 error is timeout.

Code: Select all

2017/09/18 23:34:04 [error] 3092#0: *1028 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /var/www/html/phpBB3/vendor/symfony/polyfill-mbstring/Mbstring.php on line 420" while reading response header from upstream, client: 108.234.23.251, server: frt-eve.com, request: "GET /search.php?keywords=bilibili HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "frt-eve.com"
2017/09/18 23:36:31 [error] 3092#0: *1070 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /var/www/html/phpBB3/vendor/symfony/polyfill-mbstring/Mbstring.php on line 420" while reading response header from upstream, client: 108.234.23.251, server: frt-eve.com, request: "GET /search.php?keywords=Discord HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "frt-eve.com"
Then I thought it might becasue the phpbb Native Fulltext is slow, so I swtich to Sphinx fulltext.
And I checked the sphinx log, found that it is pretty fast but I still get above timeout in nginx log.

Code: Select all

[Mon Sep 18 23:36:01.689 2017] 0.000 sec 0.000 sec [ext/2/attr- 5 (0,10)] [index_phpbb_c8d2e104f270c3ce_delta;index_phpbb_c8d2e104f270c3ce_main] Discord
[Mon Sep 18 23:37:55.110 2017] 0.000 sec 0.000 sec [ext/2/attr- 19 (0,10)] [index_phpbb_c8d2e104f270c3ce_delta;index_phpbb_c8d2e104f270c3ce_main] bilibili
[Mon Sep 18 23:39:58.211 2017] 0.000 sec 0.000 sec [ext/2/attr- 0 (0,10)] [index_phpbb_c8d2e104f270c3ce_delta;index_phpbb_c8d2e104f270c3ce_main] bilibi
[Mon Sep 18 23:50:44.451 2017] 0.000 sec 0.000 sec [ext/3/attr- 261 (0,10)] [index_phpbb_c8d2e104f270c3ce_delta;index_phpbb_c8d2e104f270c3ce_main] EVE
:shock:
Thanks in advance!

Re: Search timeout.

Posted: Fri Sep 22, 2017 1:05 pm
by NomadThanatos
BUMP...

Re: Search timeout.

Posted: Fri Sep 22, 2017 1:41 pm
by RMcGirr83

Re: Search timeout.

Posted: Sun Sep 24, 2017 2:45 am
by NomadThanatos
Thanks for your reply.

I have tried to set to 300 secs and I still got timeout.
I am using Cloudflare CDN now so 300 secs would make CDN response 502.

I try to set to 90 secs.

Code: Select all

2017/09/23 22:16:14 [error] 18418#0: *50523 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Maximum execution time of 90 seconds exceeded in /var/www/html/phpBB3/vendor/symfony/polyfill-mbstring/Mbstring.php on line 420" while reading response header from upstream, client: 162.158.69.138, server: frt-eve.com, request: "GET /search.php?keywords=Discord HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "frt-eve.com", referrer: "https://www.phpbb.com/community/viewtopic.php?f=556&t=2439031"

Code: Select all

[Sat Sep 23 22:14:44.242 2017] 0.001 sec 0.001 sec [ext/2/attr- 5 (0,10)] [index_phpbb_c8d2e104f270c3ce_delta;index_phpbb_c8d2e104f270c3ce_main] Discord
My forums has 1k users and 1.5k posts now. I run it on a VPS.
I think there are not that much users and data, I am wondering why this is such slow...
Do others' forums search work well?

Re: Search timeout.

Posted: Sun Sep 24, 2017 4:33 am
by kinerity
NomadThanatos wrote:
Sun Sep 24, 2017 2:45 am
I am using Cloudflare CDN
Cloudflare has been known to cause problems with phpBB. Have you tried removing Cloudflare just as a test?

Re: Search timeout.

Posted: Sun Sep 24, 2017 11:44 am
by Leinad4Mind
In your case I would backup the search tables and then delete the index and re-index again.
I would start by that.

Re: Search timeout.

Posted: Fri Aug 17, 2018 12:52 pm
by Explode!
Did you get to the bottom of this issue?

My board on 3.2 does it with exactly the same symptoms (500 server and execution timeout 30 or insert value here)
Maximum execution time of 30 seconds exceeded in /pathtoforum/vendor/symfony/polyfill-mbstring/Mbstring.php
This page isn’t working www.example.com is currently unable to handle this request.
HTTP ERROR 500
Most search terms work without incident just one specific has been reported so far.

Interestingly I've just found it happens when the search term is in single quotes but not when it's in double quotes, then it works..

Re: Search timeout.

Posted: Fri Aug 17, 2018 12:55 pm
by Mick
Please start your own topic by filling out the Support Request Template and posting it your new topic to enable us to assist you better.

Re: Search timeout.

Posted: Fri Aug 17, 2018 12:57 pm
by Explode!
Thanks, I'm not so worried about it, just thought if the OP had resolved it then it'd be useful to know how or why.

Since it seems to be related to the single quotes in my case, I'll just tell users not to do that and assume it's a bug.

Re: Search timeout.

Posted: Fri Aug 17, 2018 5:03 pm
by Lumpy Burgertushie
it is most likely caused by a setting of mod_security at the host level.

robert

Re: Search timeout.

Posted: Fri Aug 17, 2018 5:14 pm
by Paul
Lumpy Burgertushie wrote:
Fri Aug 17, 2018 5:03 pm
it is most likely caused by a setting of mod_security at the host level.

robert
A php timeout can't be caused by mod security

Re: Search timeout.

Posted: Fri Aug 17, 2018 5:32 pm
by Lumpy Burgertushie
however, 500 errors can and that is what the last poster said he was getting.

thanks,
robert

Re: Search timeout.

Posted: Fri Aug 17, 2018 5:49 pm
by Paul
Lumpy Burgertushie wrote:
Fri Aug 17, 2018 5:32 pm
however, 500 errors can and that is what the last poster said he was getting.

thanks,
robert
No, he says he has the timeout together with the 500. I am also pretty certain mod security only gives 4xx errors, and not 5xx.

Re: Search timeout.

Posted: Fri Aug 17, 2018 6:34 pm
by Big Monstro
The topic author encountered timeout issue on vendor/symfony/polyfill-mbstring/Mbstring.php on line 420 when he/she used board search.

The problem is known and apparently existed since phpBB 3.2.0 (see https://tracker.phpbb.com/browse/PHPBB3-15043). I experienced myself on my own board with phpBB 3.2.2 and PHP 7.2 (not PHP 5.4 like the PHPBB3-15043 author), as well as with phpBB Native FullText as MySQL FullText.

Fortunately, the solution is quite simple : viewtopic.php?f=556&t=2466071&start=45#p14976516

You have to install mbstring PHP module! Although it's not stated (https://www.phpbb.com/support/docs/en/3.2/ug/), mbstring is an actual requirement for phpBB 3.2.x (before installing it, the board search can lasted up to five minutes per request for me, with one cpu core of my server loaded at 100% during this period. After installing mbstring, all the board search last only one second with a low level of cpu load).

I opened a ticket about that issue: https://tracker.phpbb.com/browse/PHPBB3-15754

Re: Search timeout.

Posted: Fri Aug 17, 2018 6:47 pm
by Explode!
Big Monstro, this sounds like my issue, I'll give that a try and report back.