Magento hanging on Admin Login page (Unsolved/Mystery)

This morning, I ran into the following issue:

  1. Loaded up the Magento 2 login screen
  2. Entered my credentials
  3. Clicked Sign In

At this point, I’m obviously expecting the login to complete and take me to the Backend. However, instead the Web Browser loading icon just kept going round and round. I tried again in various tabs and even Incognito. Same result - Stuck on the login page and not able to advance.

Out of desperation I attempted the following:

  • Login with cleared cookies
  • redis-cli flushall
  • sudo service mysql restart
  • sudo service httpd restart
  • bin/magento cache:flush
  • bin/magento cache:clean
  • bin/magento indexer:reindex

None of the above appeared to have an effect. However, within 5-10 minutes of running the last command, the page that I still had open in my browser (that was still loading) finally kicked into life and loaded in. I logged out/in several times after that to test it and everything was fine. Coincidence?

So far, I’ve been unable to find any logs relating to the incident. The worst issues are the ones that fix themselves. Because you never know what caused them and whether they will happen again.

Having done some research after-the-fact, I’m going to see if the following helps:

  1. Add a domain to core_config_data/web/cookie/cookie_domain via phpMyAdmin
  2. Remove value from core_config_data/web/cookie/cookie_lifetime
  3. Recompile