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 over 7 years ago. Updated about 6 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 #1

Updated by Gerrit Code Review over 7 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53273

Actions #2

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53273

Actions #3

Updated by Gerrit Code Review over 7 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53273

Actions #4

Updated by Gerrit Code Review over 7 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53273

Actions #5

Updated by Gerrit Code Review over 7 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53273

Actions #6

Updated by Gerrit Code Review over 7 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53273

Actions #7

Updated by Kasper Ligaard over 7 years ago

  • Category set to Caching
  • Target version set to Candidate for patchlevel
Actions #8

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53401

Actions #9

Updated by Kasper Ligaard over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #10

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF