w3-total-cache-fixed icon indicating copy to clipboard operation
w3-total-cache-fixed copied to clipboard

redis cache connection bug

Open hsntgm opened this issue 8 years ago • 3 comments

Hello,

Redis cache doesn't connect to w3 total cache when it is setted to default redis unix socket /tmp/redis.sock.

So i created new systemd script for redis to listen other unix.socket.

unix socket

After setting it up to new socket w3 is able to listen this socket.

w3_bug

Tested and working.

working on unix socket

But if you want to set redis-server password w3 always refuses the connection !

redis_pass

redis_auth_bug

mod_fcgid: stderr: Redis server went away, referer: https://www.example.com/wp-admin/admin.php?page=w3tc_dbcache

mod_fcgid: stderr: PHP Warning: Redis::pconnect(): connect() failed: Connection refused in /home/www/public_html/wp-content/plugins/w3-total-cache/Cache_Redis.php on line 335, referer: https://www.example.com/wp-admin/admin.php?page=w3tc_dbcache

dig line 335 ..

if ( substr( $server, 0, 5 ) == 'unix:' ) {
    if ( $this->_persistent )
        $accessor->pconnect( trim( substr( $server, 5 ) ) );
    else
        $accessor->connect( trim( substr( $server, 5 ) ) );
} else {
    list( $ip, $port ) = explode( ':', $server );

    if ( $this->_persistent )
        $accessor->pconnect( trim( $ip ), (integer) trim( $port ) ); // !!!!!!!!!!!!!!!
    else
	$accessor->connect( trim( $ip ), (integer) trim( $port ) );
} 

So i added unix: prefix unix:/var/run/redis/redis.sock and tried with auth pass and failed again.

Best Regards,

hsntgm avatar Feb 24 '17 18:02 hsntgm

@hsntgm can you confirm if pr #430 solve this issue?

nigrosimone avatar Mar 04 '17 08:03 nigrosimone

Unfortunately no, but you are on the right way. W3 connect with redis with redis pass so it is false fail message.

Sincerely,

hsntgm avatar Mar 04 '17 16:03 hsntgm

@hsntgm sorry for the very long delay. We have found a bug into the redis persistent connection and it seem your issue. You can check if make this change https://github.com/szepeviktor/w3-total-cache-fixed/pull/483/files in the PR https://github.com/szepeviktor/w3-total-cache-fixed/pull/483 help you?

thanks.

nigrosimone avatar May 20 '17 07:05 nigrosimone