Magento 2.2.6 Indexer Issues After Upgrade – How to Fix

magento2magento2.2magento2.2.6

Php 7.0
Magento 2.1.0 upgrading to 2.2.6
Apache 2.4.6
DB: Maria DB
Plesk 17.5.3

I'm having trouble with one of my new sites after upgrading to 2.2.6, from 2.1.0.
Updated composer file, then ran:

composer update

Then from there, I run my usual code for upgrades or any issues which is usually the saviour and after 15-20 minutes (and above for larger sites) everything is good:

rm -rf var/di/* && rm -rf var/generation/* &&   rm -rf var/cache/* && php bin/magento setup:upgrade && php bin/magento setup:di:compile && php bin/magento setup:static-content:deploy en_GB en_US  && chmod -R 777 var pub/static  && php bin/magento indexer:reindex &&  php bin/magento cache:clean && php bin/magento cache:flush

However when it gets to the indexer:reindex script I get thrown the following:

sh-4.2$ php bin/magento indexer:reindex
Design Config Grid index has been rebuilt successfully in 00:00:09
PHP Warning:  Uncaught Magento\Framework\Exception\SessionException: Unable to connect to Redis in /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SaveHandler/Redis.php:65
Stack trace:
#0 /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SaveHandler/Redis.php(81): Magento\Framework\Session\SaveHandler\Redis->getConnection()
#1 /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SaveHandler.php(72): Magento\Framework\Session\SaveHandler\Redis->open('/var/lib/php/se...', 'admin')
#2 [internal function]: Magento\Framework\Session\SaveHandler->open('/var/lib/php/se...', 'admin')
#3 /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SessionManager.php(189): session_start()
#4 /var/www/vhosts/EXAMPLE.co.uk/httpdocs/generated/code/Magento/Backend/Model/Session/Interceptor.php(24): Magento\Framework\Session\SessionManager->start()
#5 /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SessionManager.php(130): Mage in /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SaveHandler/Redis.php on line 65
PHP Fatal error:  session_start(): Failed to initialize storage module: user (path: /var/lib/php/session) in /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SessionManager.php on line 189
PHP Fatal error:  Uncaught Magento\Framework\Exception\SessionException: Unable to connect to Redis in /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SaveHandler/Redis.php:65
Stack trace:
#0 /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SaveHandler/Redis.php(134): Magento\Framework\Session\SaveHandler\Redis->getConnection()
#1 /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SaveHandler.php(82): Magento\Framework\Session\SaveHandler\Redis->close()
#2 [internal function]: Magento\Framework\Session\SaveHandler->close()
#3 {main}
  thrown in /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/magento/framework/Session/SaveHandler/Redis.php on line 65

Now from here I was unable to do anything, no helpful errors and I couldn't get any further.
I tried:

php bin/magento indexer:reset
php bin/magento indexer:reindex

And got the same errors as before, so now checking:

sh-4.2$ php bin/magento indexer:status
+----------------------+------------------+-----------+--------------------------+---------------------+
| Title                | Status           | Update On | Schedule Status          | Schedule Updated    |
+----------------------+------------------+-----------+--------------------------+---------------------+
| Catalog Product Rule | Reindex required | Schedule  | idle (0 in backlog)      | 2018-09-24 19:12:15 |
| Catalog Rule Product | Reindex required | Schedule  | idle (0 in backlog)      | 2018-09-24 19:12:13 |
| Catalog Search       | Reindex required | Schedule  | idle (0 in backlog)      | 2018-09-24 19:12:15 |
| Category Flat Data   | Reindex required | Schedule  | idle (0 in backlog)      | 2018-09-24 19:12:13 |
| Category Products    | Reindex required | Schedule  | suspended (0 in backlog) | 2018-09-24 18:49:00 |
| Customer Grid        | Processing       | Schedule  | suspended (0 in backlog) | 2018-09-24 19:11:56 |
| Design Config Grid   | Ready            | Schedule  | idle (0 in backlog)      | 2018-09-24 19:12:13 |
| Product Categories   | Reindex required | Schedule  | suspended (0 in backlog) | 2018-09-24 18:49:28 |
| Product EAV          | Reindex required | Schedule  | idle (0 in backlog)      | 2018-09-24 19:12:14 |
| Product Flat Data    | Reindex required | Schedule  | suspended (0 in backlog) | 2018-09-24 18:53:59 |
| Product Price        | Reindex required | Schedule  | idle (0 in backlog)      | 2018-09-24 19:12:14 |
| Stock                | Reindex required | Schedule  | idle (0 in backlog)      | 2018-09-24 19:12:14 |
+----------------------+------------------+-----------+--------------------------+---------------------+

As you can see, i've got suspended indexers and it says that one of them is currently processing, but has been for a day.

In my logs, the only thing I can see that I assume is related is the following:

[2018-09-24 19:17:39] main.CRITICAL: Connection to Redis redismaster:6379 failed after 1 failures.Last Error : (1) Warning: Redis::connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/vhosts/EXAMPLE.co.uk/httpdocs/vendor/colinmollenhour/credis/Client.php on line 444 [] []

After looking online I can't see anyone else with the same issue. Anyone had or fixed this?

I tried reverting back to 2.1.0 and attempting a second time and the same happened again. However 2.2.5 worked fine, so then tried 2.2.5 to 2.2.6 and the same happened again.

Best Answer

Try to disable redis In app/etc/env.php

Comment line responsible for caching using redis and flush cache.

https://community.magento.com/t5/Magento-2-x-Admin-Configuration/Disabling-Redis-cache-from-command-line/td-p/89599

If this work and you want to use redis you can read documentation how to setup redis server from begining.

Related Topic