23

I am facing Strangest Problem ever in magento. we are using 1.9.0 version.

from last 2 months, our live site is "blank" or "keep on loading" for used browsers. Means in this browser we visited the site lot of times.

in some browsers, its working fine. in some showing blank.

but backend is working fine in all browsers.

we are facing problem in chrome, mozilla , opera and all other browsers.

1)If we clear the browser history[cache and cookies], than its working.

2)If we open the same site in private window , its working.

3)If we open the site in freshly installed browsers, its working for some time. again blank after we used the site.

4)If we clear the var/session folder, than it will start to work for all browsers for some time. again site blank.

5)sometimes, site will be keep on loading and it will never load....

I checked system.log & exception.log . but seems there are no errors related to this. we are using https for secure pages. even we have live Andriod app for this site. sometimes we will get Fatal errors :

**Fatal error**: Allowed memory size of 536870912 bytes exhausted (tried to allocate 85 bytes) in /lib/Zend/Db/Statement/Pdo.php or lib/Varien/Object.php or /lib/Varien/Db/Select.php or app/code/core/Mage/Core/Model/Config.php

we set memory_limit = 1512 Mb in php.ini

in .htaccess we have following files.

php_value memory_limit 1512M php_value max_execution_time 18000

we uncommented this :

ini_set('display_errors', 1);

but no error displaying in frontend. This is apache error log :

child pid 23845 exit signal Segmentation fault (11), possible coredump in /etc/apache2

Really struggling to solve this problem. Is this problem related to our code or is this problem related to server side ?

is browser cookie is the main problem ? If so what need to do to solve this cookie problem for all browsers. why its started working once we clear session folder?

we face these issues when browsing our site. enter image description here enter image description here enter image description here

  • is it possible that its a cookie issue? stackoverflow.com/questions/15491819/… – pzirkind Dec 15 '15 at 19:30
  • the link i pasted is for backend but the frontend may have a cookie issue also...it may be due to the lifetime of the cookie and the timestamp of the server is off – pzirkind Dec 15 '15 at 19:31
  • @pzirkind in our case backend is fine for all browsers. than is we have to increase the lifetime of cookie through code? and i did't got about timestamp of the server is off. is we have to make it on? – Baby in Magento Dec 15 '15 at 19:35
  • @Babby in Magento sometimes if the server does not have correct timestamp it will generate a cookie that expires before current date, so when customer reloads the site and magento checks the cookie its invalid – pzirkind Dec 15 '15 at 20:00
  • @pzirkind Is there any possibility that apache error posted in question or timestamp may be the reason for this blank page? – Baby in Magento Dec 15 '15 at 20:02
10
+150

First enable Developer mode in your .htaccess file, add the following at the end of the file:

SetEnv MAGE_IS_DEVELOPER_MODE "true"

Next edit index.php and uncomment the line:

#ini_set('display_errors', 1);

Line referenced:

Next login via SSH and look for a core dump file under /tmp as the segment fault error mentioned. Sometimes it can also be in the root / or in the root directory of the site itself for example: /var/www/html/videomergerapp/.

If you are unable to locate any core dump files, you may want to add some additional directives to PHP/Apache.

Take a look here:

Once you have the core dump file(s), you can use gdb (if --enable-debug) was used when PHP was configured. You can make this determination by issuing the following from the Command Line:

php -i | grep debug or simply creating a php script file in your webserver root with: <?php phpinfo(); ?> in its contents and view the file via web browser to see the PHP configuration values.

If it was not enabled, then you won't be able to get a full backtrace into PHP itself but only higher level system calls and/or apache backtrace:

If you do have access to the core dump file issuing something like the following will give you a backtrace to help find the point of failure:

gdb /usr/local/apache2/bin/httpd /tmp/core.2027


If you are only experiencing the random issues on the frontend and never the backend, then most signs point to a possible issue with your template coding. Once you experience the blank pages (and/or error displays if you have enabled developer mode and error display). Login to your admin and disable all caches and flush all caches and cache storages.

Then going into app/etc/local.xml and set the disable local modules to true.

<disable_local_modules>true</disable_local_modules>

This will disable the auto loader from loading any modules in app/code/local.

To disable community modules it is easiest to go through each of your modules definition files found in app/etc/modules and disabling by setting the active node to false like so:

<active>false</active>

This way you can help rule out if a 3rd party module is causing the source of the issue by process of elimination. NOTE: You can not disable_local_modules and simply go through all of your NON-CORE modules (anything Mage_* ignore!).

If there is still issues then I would attempt a default template package temporarily by going to System > Design and defining a new design of something like default or base. If the stock template packages work then you will know the cause of the error is living in your template design files (.phtml).

A lot of templates I've run into are bad about using Mage::getModel()->load() within foreach loops as this is bad practice and can ultimately consume large amounts of server memory and resources.

Magento does have Code Analysis tool that may help scan your template files to determine if there any of these bad pieces of code:

Further reading:

Also, it may be helpful for everyone what cache and session storage you are using that is defined in app/etc/local.xml.

Hope this helps!

  • i will try this nad let you know.... – Baby in Magento Dec 16 '15 at 4:52
  • we cleared the var/session folder . than it solved our problem until today. but today this problem again happened. than i added this in .htaccess : SetEnv MAGE_IS_DEVELOPER_MODE "true" and uncomment ini_set('display_errors', 1); this line. and <disable_local_modules>true</disable_local_modules> . Than i got tjis error : magento.stackexchange.com/questions/94559/… – Baby in Magento Dec 21 '15 at 16:03
  • i am not clearing any sessin after i do some chnages, if i clear the session automatically its going to solve all the problem. dont you think its something related cookies or sessions ? is there any way to solve this ? – Baby in Magento Dec 21 '15 at 16:04
  • @BabyinMagento Were you able to get the problem resolved based on the information provided? If so what was the issue for those other experiencing a similar issue? Thanks. – B00MER Dec 22 '15 at 18:09
  • 1
    Thanks a lot for your support. we cleared the session folder and hide cookie related things in varien.php. but still we need to wait for some more time to check whether we got permanent solution or not. right we got solution as we cleared session folder. – Baby in Magento Dec 22 '15 at 18:25
3

My guess is there is a recursion in your code. Edit the file lib/Varien/Db/Adapter/Pdo/Mysql.php and set $_debug and $_logCallStack to true. This should log the call stack in var/debug/pdo_mysql.log file which should give you an idea if there is a recursion in your code when it takes forever to load. Note that this file will keep growing very rapidly so ideally enable it when you think the problem has started on site.

Other way is to disable buggy modules/extensions that you think could cause this. This could be your simple configurable prices extension too, try to disable it temporary and see if it helps prevent the issue.

  • i changed values of "$_debug" and "$_logCallStack" to true, now i am waiting for pdo_mysql.log file. and our log folders are filling too much , its almost about 90 gb of logs are there. i installed the simple configurable extension before 2 weeks, this problem was there from 2 months. but still need to look at other buggy modules. – Baby in Magento Feb 16 '16 at 18:57
  • i didt found this file var/debug/pdo_mysql.log until now, but system and exception logs created. i can see this log mainly : "lib/Varien/Simplexml/Config.php on line 510" – Baby in Magento Feb 16 '16 at 19:01
  • 90 GB of logs? wow! Backup them to some different place and empty the files. that should atleast help somewhat improve your site speed. – Kalpesh Feb 16 '16 at 19:11
  • yes, you are right. we keep on deleting after some times. is those logs because of this issue ? and until now i didt found any pdo_mysql.log – Baby in Magento Feb 16 '16 at 19:13
  • Check the value of $_debugFile in Mysql.php file and make sure your var directory has proper permissions required to create a folder and file. – Kalpesh Feb 16 '16 at 19:19
2

I had the same issue in a customer website. Check your Magento for malware.

This is a well known scenario, ususally it is a walware redirecting the content of user's post to an external website.

Start checking index.php, they usually hack it. Scroll the code untill the end, also check to the right and between commented lines in the license heading. Hackers are used to hide code in this way.

You have the "forever loading" becasue it tries to contact websites that your ISP blocked.

It should be quite easy to find the malware, search for "base64", "eval", "mcrypt" strings.

  • this is our index.php = > pastebin.com/N8xnWMa7 – Baby in Magento Feb 16 '16 at 20:46
  • our site was hacked before 3 months, after that only this problem came. but later we took lot of security measures from server side. but do you think the hacked code still present in site and creating problem?. – Baby in Magento Feb 16 '16 at 20:49
  • Well, your index.php is fine, but your symptoms are really like the ones I've seen in some customer hacked webistes. I suggest you to perform a full search looking for the following patterns: "base64", "eval", "mcrypt", "$_POST". They will give you tons of false positives so you need to check them. If you do not find anything wrong I suggest you a cachegrind analysis or an xdebug step-by-step analysis. – Phoenix128_RiccardoT Feb 16 '16 at 20:52
  • i will search those words in our site files. – Baby in Magento Feb 16 '16 at 21:04
  • i am finding unlimited times : "base64" encode and decode texts........ – Baby in Magento Feb 16 '16 at 21:08
2

I have experienced a similar behavior on a Magento that had two websites. The site was loading well for a few pages and then loading forever.

The configuration of the base URLs was wrong. The Secure Base URL setting was set to the wrong website while the Unsecure Base URL was set correctly.

So to fix this if the admin is not even working properly, the values need to be changed in the core_config_data table for the right website i.e. set the right URL with the "http://" and a trailing slash in the value field corresponding to the path "web/unsecure/base_url" and "web/secure/base_url" for the right scope_id representing the website ID.

enter image description here

Note that the secure url is http only because it was a demo website.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.