Bug #81629

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

Added by Kasper Ligaard about 2 years ago. Updated 10 months ago.

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

100%

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.

Associated revisions

Revision d9b2c19d (diff)
Added by Kasper Ligaard about 2 years ago

[BUGFIX] Always select database number in Redis Cache Backend

When using persistent connections, we need to always select the database.

Resolves: #81629
Releases: master, 8.7
Change-Id: Ia514a8ed8f04d1108263c39a21c654de4191db8b
Reviewed-on: https://review.typo3.org/53273
Tested-by: TYPO3com <>
Reviewed-by: Markus Klein <>
Reviewed-by: Thomas Hohn <>
Tested-by: Thomas Hohn <>
Reviewed-by: Andreas Fernandez <>
Reviewed-by: Frank Naegler <>
Reviewed-by: Joerg Boesche <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision 4bb21e28 (diff)
Added by Kasper Ligaard about 2 years ago

[BUGFIX] Always select database number in Redis Cache Backend

When using persistent connections, we need to always select the database.

Resolves: #81629
Releases: master, 8.7
Change-Id: Ia514a8ed8f04d1108263c39a21c654de4191db8b
Reviewed-on: https://review.typo3.org/53401
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Gerrit Code Review about 2 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

#2 Updated by Gerrit Code Review about 2 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

#3 Updated by Gerrit Code Review about 2 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

#4 Updated by Gerrit Code Review about 2 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

#5 Updated by Gerrit Code Review about 2 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

#6 Updated by Gerrit Code Review about 2 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

#7 Updated by Kasper Ligaard about 2 years ago

  • Category set to Caching
  • Target version set to Candidate for patchlevel

#8 Updated by Gerrit Code Review about 2 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

#9 Updated by Kasper Ligaard about 2 years ago

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

#10 Updated by Benni Mack 10 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF