Project

General

Profile

Actions

Bug #81629

closed

Using persistent connections with Redis cache backend can fail if database nr. zero is used with other databases.

Added by Kasper Ligaard almost 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Caching
Start date:
2017-06-20
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

There is a rare corner-case with using the Redis Cache Backend with persistent connections. It was discovered and described in the original Gerrit patch-set https://review.typo3.org/#/c/50978/ (comment included below).

The way to fix this is to ensure that if no database number is given, then we should explicitly set it to zero.

@markus: My DevOps guy has a theory that if you use database 0 and other databases, then if not explicitly setting the database it might default to db 0.
A test case you could try is the following:
1) Create these two files in a webroot:
File A: test.php
$redis = new Redis();
$redis->pconnect('redis.eu-west-1.systime.dk', 6379);
print($redis->dbSize());
?>
File B: test2.php:
$redis = new Redis();
$redis->pconnect('redis.eu-west-1.systime.dk', 6379);
$redis->select(2);
print($redis->dbSize());
?>
2) Make sure the number of entries in the two databases a not the same
3) Try calling the scripts. The assumption should be that script test.php always gives the number of entries in db 0; and test2.php should always give the number of entries in db 2.
As far as we can see, it seems that test.php sometimes gives the number of entries from db 2. If you can confirm that, then the fix would be that we always select the correct database.
At Systime Redis database 0 isn't used, so we always select the database, which would explain why we didn't see this problem.
For now the above is only circumstantial evidence, but for now it's the best guess we have come up with to explain the symptoms your describe.

Actions

Also available in: Atom PDF