13

Ever since working with Magento 2, I repeatedly have this annoying issue:

  1. I log in to the admin panel or switch to a different page within the admin panel
  2. The page starts loading, sometimes shows up partially but then hangs forever (at least for several minutes), sometimes it shows up completely but the browser still indicates "loading" and the navigation does not work, but I don't see failed or running requests in the browser console.
  3. If I press F5 while it's hanging, the page loads almost instantly (at least most of the time)

It doesn't seem to be related to any events, because I get this behavior even without having done any changes in the admin panel, nor in the code, just navigating. However, I observed a possible correlation with invalidated caches.

Any idea what could cause this issue? I don't believe that it's the typical problems with permissions or cookies because generally speaking the admin panel works.

Magento is running in developer mode on Linux.

  • 1
    Got the exact same problem, never took the time to ask, I'm glad you did. Which PHP Version are you running ? I'm running 5.6.something and I'm pretty sure it's related. Heard lots of people told me that M2 was incredibely slow when not running PHP 7 – Raphael at Digital Pianism Apr 15 '16 at 9:50
  • 1
    PHP 5.5, would be interesting to know if anybody had this issue with PHP 7 – Fabian Schmengler Apr 15 '16 at 9:51
  • 1
    I am using PHP 7 and face the same issue – Reena Parekh Apr 15 '16 at 10:00
  • 1
    Alan Storm suggested this, maybe related maybe not: magento.stackexchange.com/questions/3720/… – Raphael at Digital Pianism Apr 15 '16 at 18:00
  • 1
    Got some problem with Magento 2.0.4 running on Vagrant (Ubuntu 14.04 / PHP 5.5.9 / MySQL 5.6.28) :( – Siarhey Uchukhlebau Apr 18 '16 at 11:33
3
+175

UPDATE

It seems like updating Firefox to 46 fixes the issue!

Original investigations

As I'm also facing this annoying problem I decided to give it a try.

Configuration

  • Ubuntu Server 12.4
  • PHP 5.5.30
  • MySQL 5.6.27
  • Magento 2.0.4 fresh install without sample
  • Developer mode with cache disabled

Replicating the issue

At first sight, this issue looked totally random to me. However after several tests, I managed to find out exactly how to replicate the issue.

Browser

First, I haven't been able to replicate the issue on Google Chrome, Internet Explorer 11 nor the old Windows Safari 5.2.17. I'm mainly using FireFox (45.0.2) and rarely use Google Chrome. Even after I've found exactly how to replicate the issue I haven't been able to replicate on Chrome.

Tabs

You need to have several tabs open on FireFox to be able to replicate the issue.

Steps

  1. Open the admin panel and login
  2. Once you're on the dashboard you can click on any menu item. I usually click on the dashboard icon again
  3. As soon as you've clicked the menu item, click on one of your opened tab and keep browsing the internet while you're waiting for your admin panel to finish loading (based on the spinning icon next to the tab title)
  4. Well unfortunately you'll never get that page loaded.

Investigation

So it seems like when the client is not focused on the tab of the Admin Panel, Magento 2 seems to not load all the resources for the website to load entirely.

What I have noticed, when I came back to the infinite loading admin panel page is that there was a lot of resources that were successfully loaded.

As Fabian said, no error in the console, no resources still loading and no resources that failed to load. Everything looked like the page had finished loading.

However, when I clicked the stop loading button of Firefox (the X in the URL bar), I noticed that several resources were added in the network tab that were not here when the page was in the infinite loading state

PLEASE NOTE: the screenshot below is only for the dashboard, I've noticed that more resources were loaded after I clicked the stop loading button on the configuration pages for instance.

enter image description here

So for the Dashboard page, those resources were added after I clicked the stop loading button.

When the page is loaded normally, by not switching to another tab, the following resources are loaded after the DOM load (I assume via AJAX), you can notice the thicker grey line between those and the resources above:

enter image description here

So for some reason, the following resources are automatically loaded when the page is in the infinite loading state but are loaded after DOM load when the page loads fine:

  • /static/adminhtml/Magento/backend/en_US/Magento_Ui/templates/modal/modal-popup.html
  • /static/adminhtml/Magento/backend/en_US/Magento_Ui/templates/modal/modal-slide.html
  • /static/adminhtml/Magento/backend/en_US/Magento_Ui/templates/modal/modal-custom.html
  • /static/adminhtml/Magento/backend/en_US/mage/apply/scripts.js

That's how far I got into my debugging task, I reckon there's still plenty we can do to test and narrow the issue but I didn't have time to make more tests, I'll come back to it when I'll have time.

Further Investigations

So I ended up installing HTTPFox plugin on my FireFox.

Here is what I got when I clicked the stop loading button after 1min of loading (you can see that jquery.storageapi.min.js has 59s in the time column). The highlighted rows are the resources that loaded after I stopped the loading:

enter image description here

I tried upgrading the jquery.storageapi library with the last version available on GitHub but it does not seem to fix the issue unfortunately.

As the favicon loading was next on the list, I commented the code adding the favicon to the head but it didn't fix the issue either.

I tried to debug the domReady.js file as its name sounds like it could be the fault but no chance.

Also here are the two access.log files:

Still can't figure out what's going on here.

Update

I recently made two changes to my installation:

  • upgrade FireFox to 46.0
  • upgrade from 2.0.4 to 2.0.5

Now I can't replicate the issue anymore.

  • 1
    Have you tried to see if there is locking session files concurrency because of those background ajax calls ? Some js files use data from ajax calls and store info in cookies about it and reverse. codingexplained.com/coding/php/… I've have Redis and Memcache in dev env and the problem looks like is gone. – obscure Apr 25 '16 at 15:58
  • @obscure thanks for your input I'll check that out tomorrow but I highly doubt it as it works when I stay on the admin tab and doesn't when I browse another non Magento tab during the load – Raphael at Digital Pianism Apr 25 '16 at 16:48
  • It seems that the firefox update till 46 version helps and it is not connected with the magento version. Could you, please, add this solution in the top of your reply in order it will be visible at once. – Siarhey Uchukhlebau May 13 '16 at 10:23
  • @SiarheyUchukhlebau done ;) – Raphael at Digital Pianism May 13 '16 at 10:24
  • 1
    Whatever it was, in current browsers and with newer Magento versions it does not happen anymore, so I'll mark it as accepted. Thanks again for your investigations. – Fabian Schmengler Sep 5 '16 at 16:18
0

I'm currently experiencing this exact problem on M2.1.2 running php 7 on a hosted NGINX server (2 cores, 2GB of ram), and I use Chrome (54.0.2840.71 m (64-bit)).

I havn't done any testing to find the source of the problem, but since this was a new server setup, I was originally assuming it was my server. Now... not so sure.

Now, I should mention I'm currently running developer mode and I have NOT compiled my code yet. So it might just be that.

0

somehow related when i update a product and change firefox to new tab to navigate and magento page lost focus, it stay in standby till come back to magento page and then finalize the update of that product, these is kind of annoing thing ... becouse i open 3-4 products and wanna work on other products till actuall one finish updating. know a solution for these issue ?

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.