You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Redis connection use the datebase 1 and set read_timeout to 1 second, if the Redis connection fails with read_timeout (RedisException), the using database change to 0
local.ERROR: read error on connection to redis:6379 {"exception":"[object] (RedisException(code: 0): read error on connection to redis:6379 at /var/www/laravel/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php:116)
Effect two scenarios
Cache: If this error occurs, the next redis command will execute on database 0
Queue Jobs: when this error occurs, queue worker still looping and worker pop jobs from the database 0, but jobs are all queued on the database 1
public function testReadTimeoutIssue()
{
/**
* $targetConn use the database 1
* $defaultConn use the database 0
*/
$targetConn = Redis::connection('example');
$defaultConn = Redis::connection();
try {
/**
* If the Redis connection fails with read_timeout,
* Redis connection database change to 0.
* use blpop to trigger read_timeout RedisException
*/
$targetConn->blpop('pop_key', 2);
} catch (\Throwable $e) {
// $e is RedisException with message read error on connection to redis:6379
}
$message = 'some data';
/**
* $targetConn database change to 0
* this test_key will set on the database 0
*/
$targetConn->set('test_key', $message);
/**
* Default connection(database:0)
* use default connection get this key
*/
$this->assertEquals($message, $defaultConn->get('test_key'));
}
The text was updated successfully, but these errors were encountered:
Description:
Redis connection use the datebase 1 and set read_timeout to 1 second, if the Redis connection fails with read_timeout (RedisException), the using database change to 0
Effect two scenarios
this issue is similar to #41302
Steps To Reproduce:
config/database.php
example
The text was updated successfully, but these errors were encountered: