Magento 2 Admin Panel hangs forever until page refresh
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
- Open the admin panel and login
- Once you're on the dashboard you can click on any menu item. I usually click on the dashboard icon again
- 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)
- 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.
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:
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:
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:
- Page is loaded: http://pastebin.com/i1DKzSeA
- Page loads forever: http://pastebin.com/t9BWi0v6
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.