Jump to content

Search "Show All" Gives White Screen...


Recommended Posts

Hi

 

I should say that I've messed around with the php.ini file and believe that all the settings are correct (max_input_time = 300, etc as per online instructions). I've also altered the my.cnf file so don't think it's that either...

 

I search for a word that a lot of my products include so let's say I get over 1000 results. It shows me the 24 okay and even 120 but if I press the "Show All" button, after anywhere from 10-30 seconds I get a white screen.

 

Any ideas?

Link to comment
Share on other sites

Try with this

     memory_limit 1024M
     max_execution_time 44000
     max_input_time -1
     upload_max_filesize 25M
     post_max_size 20M
     max_input_vars 10000

Also if you get white screen try to enable debug mode and see exact error.

https://www.prestashop.com/forums/topic/224525-how-to-turn-on-error-reporting-for-debug-information-blank-page-500-internal-server-error/

Link to comment
Share on other sites

Hi Razaro

 

Thanks for taking the time to reply.

 

Firstly, I have a 1GB server so my settings are now:

     memory_limit 924M          << did have it set to 512MB     max_execution_time 44000   << did have it set to 300     max_input_time -1          << did have it set to 300     upload_max_filesize 50M     post_max_size 50M     max_input_vars 10000

I've also got debug mode enabled but I still just get a white screen.

 

Do you have any other ideas?

 

Thanks

 

Nick

Link to comment
Share on other sites

Hi Memo1

 

My search is very slow but I put that down to the current server it's running on. I know that displaying all results used to work but now it seems to be timing out after a very small amount of time (30 secs on average).However, I thought this was highlighting a setup issue somewhere so thought it best to fix it.

 

I'd was then going to remove the "show all" button when I figure out how to.

 

I'm not sure if I'm using layered navigation.

Edit: I think I am, just looking at the module settings now.

 

Cheers

 

Nick

Edited by n_s_simpson (see edit history)
Link to comment
Share on other sites

I've been playing around with this but can't find a solution.

 

When I first changed PHP memory limit to 512mb last year when I first configured PS I didn't have any of these issues. I also remember search being relatively quick. However, I've done lots of updates since then so at some point something's broken. (When I look in webmin the memory being used is around 300mb of the 1GB available while running the search.)

 

So when I search for a common phrase it takes too long to load the first 24 or 1349 items. Sometimes I even get a white screen at this point!

Then normally when I press "Show All" I get a white screen (the results did appear once).

 

Now I've tried increasing PHP memory but I just can't get this to work properly anymore.

 

Is it that we're running out of memory or could there be a memory leak somewhere?

 

Cheers

 

Nick

Edited by n_s_simpson (see edit history)
Link to comment
Share on other sites

Could this be anything to do with the my.cfg settings?

 

 

I think 1000 are way too many to be displayed in a single page. Are you using the layered navigation as well? I really suggest you keep them to a decent number, or try an infinite scroll module

 

Would I be better upgrading my server? I really wanted to close the error before doing that but not sure if that's possible.

 

 

I've just upgraded to MariaDB 10.0 but still getting the blank screen with no errors appearing. Does anyone have a suggestion?

Edited by razaro (see edit history)
Link to comment
Share on other sites

I think I'm looking at the right error logs. There's nothing in there that relates to failed searches.

 

Here's the site: http://tinyurl.com/prjb2wt

 

If you search for "A4" you'll see what problems I'm having.

 

Also, what do you think of the overall speed?

 

It's only running on a single core with 1GB at the moment. Was going to increase that but wanted to trap this error first.

 

Cheers

 

Nick

Link to comment
Share on other sites

in phpMyAdmin I've been monitoring what's going on while searching for just the word "A4" and then pressing show all. CPU goes 100$ and memory is almost all used up too. Swap isn't used that much though. When the white page appears everything settles back down.

 

In there it as advisor section but it mainly talks about how the PS tables should be indexed differently, etc.

 

If you click on the link in my previous post you'll see the following:

 

58820 ms - You'd better run your shop on a toaster

 

I'm tearing my hair out so could really do with some help if someone has the time to spend :)

 

I know that I should expect a slow speed due to my server but what's causing the white page? Surely the server can return and load the results eventually.

Edited by n_s_simpson (see edit history)
Link to comment
Share on other sites

In the monitor section of phpMyAdmin:

 

Before pressing "Show All" the memory usage was around 550mb and processor was idol.

 

Pressing "Show All" the memory usage jumps to almost use up the full 1GB the server has to offer and the swap memory jumps a little.

 

Blank screen.

 

Processor drops to idol, memory drops to around 400mb.

 

Interestingly, when I use the search you can see the processor being used but the memory usage stays pretty level. It's only when I press "Show All" that it goes mental.

 

There's nothing in syslog about mysql being killed and the website still functions normally.

 

Does anyone have a clue about what's going on?

 

Thanks

 

Nick

post-846853-0-24253000-1440064717_thumb.png

Edited by n_s_simpson (see edit history)
Link to comment
Share on other sites

Bit of background, I installed OPCache and APCu. I've just switched of APC in PS backoffice and the page eventually loads.

I tried to show all 4500 items that included the word "the" and that did still white screen after almost 3 minutes. Once I can get the thing to never white screen I'm going to improve the server spec.

 

So I think the issue is with caching. What do people think?

Link to comment
Share on other sites

Okay, since turning off APCu in PS I'm now getting an internal server error (500) when seaching for the word "the" and then trying to show the first 200 of them. I also get this in the error.log:

[Thu Aug 20 14:50:00.233216 2015] [fastcgi:error] [pid 1258:tid 140367575869184] (104)Connection reset by peer: [client x.x.x.x:65201] FastCGI: comm with server "/usr/lib/cgi-bin/php5.fcgi" aborted: read failed[Thu Aug 20 14:50:00.236723 2015] [fastcgi:error] [pid 1258:tid 140367575869184] [client x.x.x.x:65201] FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/php5.fcgi"

Finally I have some errors to share! Any idea what's causing the error?

 

Once we work that you I can hopefully switch APCu back on and it will actually give me some performance gain.

 

Cheers

Edited by n_s_simpson (see edit history)
Link to comment
Share on other sites

Found in one really old post possible solution, but not sure about it

 

 

 

change host association for .php files from FastCGI to just straight PHP 5.x 

 

Also check this about APC http://serverfault.com/questions/649617/php-apc-cause-server-crash-on-prestashop-1-6

 

And why you even can search the, it should be blacklisted in Preferences - Search ? :-)

 

I know you just testing , but you do not have to be that precise.

Link to comment
Share on other sites

Cheers for the advice. The 500 error only actually appears with APC (or APCu) turned off. When it's on I just get a white screen and no reported errors.

 

I don't really understand the caching thing if I'm honest. All I know is that in PS when it's set to disabled I feel like I'm missing out on something so I found out about APCu and installed it. I then changed a few opcache.ini files as per some instructions I read. Now I'm not 100% sure if that somehow treads on the toes of OPCache and whether you just install both or if you have to turn bits of OPCache off to use them together. What I do know is that I don't see any performance boost at all so now sure it's actually doing anything.

Link to comment
Share on other sites

Urm, well I doubled the server to 2 cores and 2 GB RAM but searching "the" is no quicker.

 

Couple of odd finds...

 

Set memory_limit to 32M and EVERY search returns a blank white page so I would assume that a blank page indicates the memory limit's reached.

 

I've set memory_limit to various values all the way to 1900M and I still get error 500 when trying to show all 4246 results containing "the".

(I did also get a blank white page once.)

 

So is the 500 error caused by something else?

 

Please please please help :)

Edited by n_s_simpson (see edit history)
Link to comment
Share on other sites

I thought I should try 4 cores and 8GB RAM but searching for "the" and then Show All still causes 500 error. Take a look at the screenshot to see that the processors hardly did anything.

 

Coincidentally, even will all that power larger searches were no quicker.

 

Oh, and just to recap - turning on APC (aka APCu) doesn't speed anything up from what I can tell. However, instead of large searches eventually showing me a 500 server error page I just get a blank page instead. All fun and games.

 

HELP!! :)

post-846853-0-99725800-1440111949_thumb.png

Edited by n_s_simpson (see edit history)
Link to comment
Share on other sites

I guess I'm not going to find out why I'm getting a 500 server error page.

 

(I should mention that I have "Search within word" enabled due to the type of products sold so I guess that's not helping search times.)

 

Can someone then please tell me how to remove "Show All" from within the search results?

 

Thanks

 

Nick

Link to comment
Share on other sites

You can get rd of this in the FrontController
 

if ((int)Tools::getValue('n') && (int)$total_products > 0)
$n_array[] = $total_products;


But make sure you add a condition if you only want it to be disabled on the search page
Link to comment
Share on other sites

Cheers for the info. I'll have to get my programmer to do that next week when she's back because not sure how to do that (was hoping there was just a switch I could turn off haha).

 

Do you personally normally keep "Show All" on the results page? If so, what happens on your site if there are 1000's of results. Does it timeout like mine? (Just trying to work out if my problem is a PS limitation rather than my server).

Link to comment
Share on other sites

Now when I click "Show all" button it takes a long time like 20 or 30 seconds and then I get a white page.

 

This could be a php issues, check /var/log/php5-fpm.log maybe it has some useful information about the error.

Also in /etc/php5/fpm/php.ini try to set a higher value to max_execution_time. It defaults to 30 seconds and I think your store takes more than that to load 3000 products.

 

Hope this helps.

 

LE: I clicked show all again and this is what I got:

"The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log."

Edited by Catalin Scaesteanu (see edit history)
Link to comment
Share on other sites

Hi Catalin, I've looked at those logs and there are no errors showing.

 

Max_execution_time is set to 300 seconds and it definitely shows the white page before then.

 

It's strange that when searching for the word "the" it works out that there are 3786 matching products within just a few seconds. Yet when pressing Show All it then goes away and does some longwinded computational stuff rather than simply loading the list of products it's already found. I just don't get it.

Edited by n_s_simpson (see edit history)
Link to comment
Share on other sites

I've read so many posts about adding this to my virtual hosts:

 

<IfModule mod_fcgid.c>
FcgidMaxProcesses 150
FcgidMaxProcessesPerClass 100
FcgidIOTimeout 300
FcgidMinProcessesPerClass 1
FcgidIdleTimeout 300
FcgidIdleScanInterval 120
FcgidBusyTimeout 300
FcgidBusyScanInterval 120
FcgidErrorScanInterval 10
FcgidZombieScanInterval 3
FcgidProcessLifeTime 3600
</IfModule> 

 

It made absolutely no difference.

 

Does anyone have any other suggestions?

Link to comment
Share on other sites

I managed to turn on errors by editing /etc/php5/fpm/php.ini and I got this:

Aug 26 01:42:26 devilprinters kernel: [ 6836.251265] traps: php5-fpm[7592] general protection ip:6d4287 sp:7ffebb7baa90 error:0 in php5-fpm[400000+81b000]

Can anyone work out what's going on now that I've managed to get this out of the server? More importantly is there a fix?

 

Thanks

 

Nick

Link to comment
Share on other sites

Hi Dh42, thanks for the pointers. I really like the look of lazy loading :)

 

The issue we have is that we're not sure why the page fails to load in the first place so I wonder if removing the load on the server by not making it fire over the images will stop the 500 server error,

 

We've looked at all the logs we can think of and nothing really explains what the problem is. We don't think it's the mysql that's crashing but beyond that we just have no idea.

 

The "Show All" button is a hardcoded part of PS although I will be removing it because for a large store it's not really suitable. That being said, I just want to make sure my store is robust so would like to see that it can load all the records without falling over.

 

(I'd just like to know why it's falling over more than anything.)

 

Cheers

 

Nick

Link to comment
Share on other sites

HI Dh42, thanks for your time earlier.

 

I've just spun up a DigitalOcean droplet with 16GB RAM and 8 CPUs. I changed the php.ini file so it could use all the RAM (for testing purposes).

 

With APCu off in the PS BO I tried doing a search for "the" and pressing Show All but after 10 minutes it ate up all the RAM then crashed giving me a 500 error!

 

With APCu turned on in the PS BO the memory stays still for about a minute, then creeps up to about 4.5GB before crashing at around the 3 minute mark with a white screen (maybe I have a timeout set somewhere for APCu).

 

The total processor usage moves around the 0-10% mark so I guess it's not going to be any quicker than the cheaper options DigitalOcean have.

 

I then tried to load the first 2000 products and it used 8GB RAM and after a long time it eventually loaded.

 

I turned on profiling and ran it again so I have that info if that's useful (this time I got a complaint about a long running script located in /themes/default-bootstrap/cache so not sure what that's all about but I closed it and the page loaded).

 

So does this mean that PS is incapable or returning over 3000 products and displaying them all on the one page? I can't get over how much RAM is used to do all the calculations and I wonder if that's normal.

 

Cheers

 

Nick

Edited by n_s_simpson (see edit history)
Link to comment
Share on other sites

In all reality what you are asking is a difficult question that depends on a lot of factors. Can it do it? Yes it can. Was it made to do it? No not really. 

 

On top of that your server set up is part of the problem as well. You are running fastcgi, which is like a drag racing car. It is great at small quick things like loading pages and other quick type requests like that. But it is not good at brute force tasks. That is why they have the wait timeouts built in by default, because the upper level memory handling is not that great. Not to say it is bad, it is actually very good. It is just not made to do what you are wanting to do. 

 

That is why I asked if you had suPHP installed. It is the brute force interpreter. It is made to handle really inefficient task like loading that much data. But the caveat to using it is you cannot use an opcache nor can it serve pages near as quickly as fastcgi. So there in lies your problem. 

 

One thing I would explore as well is your my.cnf file. I would increase the buffers on it by double and I would also look at your memory setting too. Because the wait time you are experiencing is coming directly from mysql, so it might be able to be tuned a bit to help. You might try installing mysqltuner.pl and see if it can give you any suggestions. 

 

 

If none of that works I would look at spinning another instance and running it with a brute force database for search results only. You could more than likely tap into PrestaShop's mysql slave and just return results from that database.

Link to comment
Share on other sites

Cheers for the clarification. I'll be removing Show All over the weekend now I know it's not my server that's the problem.

 

Interestingly phpMyAdmin has it's own Global Variables, which are different to those in my.conf. Any ideas which one is actually used?

 

Cheers

 

Nick

Link to comment
Share on other sites

That is a complicated one in itself too. It depends on where phpMyAdmin is installed. If you have it running in the same directory as your site, then it is picking up the variables from your site. If you have it running above your site it is most likely using its own values. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...