Kdyby / Redis

Redis storage for Nette Framework
http://packagist.org/packages/kdyby/redis
Other
49 stars 70 forks source link

Configuration behaviour on v6.0 #111

Open elcheco opened 3 years ago

elcheco commented 3 years ago

On the v6.0 I have found some config issues and reported in #106 which solved @PavelJurasek and merged by @VBoss

It looked it's working fine, but finally yesterday I was setting this new version from our local development to staging and production and I have found some other issues:

In some cases, when you specify a different database then it looks like it's creating another connection, but it does not take other values like auth and host:

redis:
    host: localhost
    port: 6379
    auth: hash_key
    database: 0
    journal: true
    storage: true
    session:
        database: 1
        auth: hash_key
    debugger: true

If I don't specify auth - it's dying on the exception Client of tcp://127.0.0.1:6379; ERR Client sent AUTH, but no password is set, but when I debug the Client, I saw that the normal client has all the credentials, but other with database1 has no hash, if I specified it, it works.

This is the behavior on our staging and local VM on Ubuntu, where we have all on one server. On the live infrastructure, where we have several web instances and one Redis server it works without the necessary auth under session, but we have no localhost, but internal DNS record to sey-www-prod-redis.

But interesting was that first I set the config the same way on staging and I got another exception: Nette\InvalidStateException: Failed to read session data: redis (path: tcp://127.0.0.1:6379?weight=1&timeout=10&database=1&prefix=Nette.Session%3A&auth=authhash. When I removed the auth from the session, it works. So here it looks like it does not take the host from the main configuration, but only when auth is set. The working config on the live server is:

redis:
    host: sey-www-prod-redis
    port: 6379
    auth: hash_key
    database: 2
    journal: true
    storage: true
    session:
        database: 1
    debugger: true

Until the v5.2 it worked all fine. The main idea is to have separate sessions and with deployment, we can clean the application cache.

Spamercz commented 2 years ago

Could you try if https://github.com/Kdyby/Redis/releases/tag/v6.1.0 resolves this issue?

goodexperience commented 2 years ago

Issue is probably in this commit https://github.com/Kdyby/Redis/commit/4db99336923fe34c8bd802d21758fb75e78edae5?diff=split . Having same issue with specifying native. As left has higher priority, the settings in "session" doesn't overwrite the original settings.