Magento2: Redis cache need Fix

Created on 14 Aug 2017  路  31Comments  路  Source: magento/magento2


Preconditions


  1. magento 2.1.7 to 2.1.8 php7.0-fpm,mysql 5.7
  2. 2.

Steps to reproduce

  1. composer require magento/product-community-edition 2.1.8--no-update
  2. composer update
  3. php bin/magento setup:upgrade

Expected result

  1. Cannot instantiate interface Magento\Framework\App\Config\ConfigSourceInterface in /home/dev/public_html/current/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:73

Actual result

  1. [Screenshot, logs]
    image

Clear Description Confirmed Format is valid bug report

Most helpful comment

Solved the issue. In my case it is because the Redis cache. Flush all the cache will solve the issue.

All 31 comments

+1
Same problem here.

Solved the issue. In my case it is because the Redis cache. Flush all the cache will solve the issue.

can you tell me exactly step by step

@ngocdb thank pro 馃憤 I solved issue

I also had this issue. Flushing the cache did not solve it as the console was giving me the same issue. But a second run composer update fixed it. I believe it has something to do with autoload files not being properly generated the first time.

if I only use cache file everything ok.but If I use cache Redis cache so still the an error

@denchev This helped for me, thank you.

hey!! do you have redis cache

I am seeing exactly the same error after upgrading from 2.1.7 to 2.1.8 with REDIS cache enabled.

Cannot instantiate interface Magento\Framework\App\Config\ConfigSourceInterface

If I disable redis by removing the redis config from env.php Magento starts normally. If I enable redis again the error is shown.

me too.I guess the issue of Magento 2.1.8

Are you in development mode?

If so this resolved it for me

  1. remove redis default (system) config from env.php
  2. switch to production mode
  3. after compilation add redis config back into env.php
  4. flush caches
  5. switch back to development

thank you !!

Just updated the Credis module to 1.8.2 can solved this issue in M2.1.8.

https://github.com/colinmollenhour/credis/archive/1.8.2.tar.gz

@mugua can you tell me.How to can apply your code to my project.

Running php bin/magento setup:upgrade resolved this for me.

@tomnyson
1: update composer.json & composer.lock (credis module) to the lastest version.
2: php bin/magento setup:upgrade

Hi @tomnyson. Cannot reproduce your issue on clean instance. May be you have some additional modules or specific store configurations? Please, provide more details to identify your issue.

I've had the same issue when upgrading from 2.1.7 to 2.1.8, it took me an hour to figure this out, flushing the redis cache worked!

Hi @tomnyson. Internal ticket MAGETWO-72383 created.

The only thing that worked for me was disabling redis in env.php. I cannot update to a more recent version of credis due to the meta-package specifying the version for me :(

If this is the solution, how can redis be updated to the latest version if magento/product-community-edition requires 1.6? Does that mean that we have to move away from using the meta package if we want to use redis?

This is a little concerning as we had promised to upgrade a live site to 2.1.8 but that relies on redis for caching.

Here's a solution if you use the meta-package:

  1. Download Credis 1.8.2 to somewhere like app/code/Credis/
  2. Add the following sections into your composer.json to tell composer not to bother pulling in credis, and handle the class mapping:
    "replace": { "colinmollenhour/credis": "*" }
    and also the following as part of the "autoload" section as credis is not psr-0 compliant:
    "autoload": { ... "classmap": [ "app/code/Credis/Client.php", "app/code/Credis/Cluster.php", "app/code/Credis/Sentinel.php", "app/code/Credis/Module.php" ] }

Having made my change above, I'm getting an intermittent error:

"a:4:{i:0;s:24:"read error on connection";i:1;s:3327:"#0 .../web-root/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(397): Credis_Client->__call('exec', Array)
#1 .../web-root/vendor/magento/zendframework1/library/Zend/Cache/Core.php(390): Cm_Cache_Backend_Redis->save('a:5:{i:0;a:1206...', 'dca_DICONFIG07A...', Array, NULL)"
...

I am not getting this on my <2.1.8 sites on the same server, so redis has not gone away.

It's possible that just swapping in Credis 1.8.2 is not enough to fix this issue, or there may be a second issue.

This is a serious issue for 2.1.x. I assume that if this is fixed for 2.2 it will be ported back to 2.1, or you're going to leave 2.1 in a seriously broken state - not being able to use Redis at all is a major problem for us and we're considering going back to 2.1.7 as 2.2 is too big a change at the moment.

The issue should be fixed in https://github.com/magento/magento2/pull/11222

@tomnyson, thank you for your report.
The issue is already fixed in 2.1.9

@magento-engcom-team could you please explain in what way this is fixed for 2.1.9 as colinmollenhour/credis is still set at v1.6 which is part of the problem. When exactly was this fixed and why can't I see it?

I have to admit that my work-around no longer works.

In theory you also need to download the src/ folder of https://github.com/colinmollenhour/php-redis-session-abstract to your code folder. And add the following to your replace section of composer.json:

"colinmollenhour/php-redis-session-abstract": "*"

This is in addition to the changes above.

HOWEVER, when compiling you get this error:

HP Fatal error: Class Magento\Framework\Session\SaveHandler\Redis\Config contains 5 abstract methods and must therefore be declared abstract or implement the remaining methods (Cm\RedisSession\Handler\ConfigInterface::getFailAfter, Cm\RedisSession\Handler\ConfigInterface::getSentinelServers, Cm\RedisSession\Handler\ConfigInterface::getSentinelMaster, ...) in /var/www/vhosts/sanddollardubai.com/deploy/release-candidate/vendor/magento/framework/Session/SaveHandler/Redis/Config.php on line 16

Issue reopened for further investigation. Inappropriate comments removed.
Please provide clear steps to reproduce, initial description does not have any information regarding redis.

Apologies for shouting. I'll reproduce and update here.

To my shame, having removed all my workarounds I now cannot find any issue to report. This is especially embarrassing given my desperate earlier messages. Something must have been fixed in 2.1.9 but I assumed that as the versions of redis and libraries had not updated that there was still an issue. I'll go and eat some humble pie now. Please close this.

@maderlock Thank you for the update. Closing this issue now per your request.

Was this page helpful?
0 / 5 - 0 ratings