Review main Merged

61393[BUGFIX] Make redis pconnect calls unique

Markus Klein CR +2 V +2 Easy +4 −2 updated 08/07/19, 10:29

Commit message

By using the persistent_id parameter of the redis->pconnect
method, we ensure that the connection is not shared between
multiple Redis*Backends connecting to the same Redis server.

Omitting the persistent_id causes the same connection to be reused
whenever another Redis*Backend is created, whereby the last
connection selects the database to use for the connection, effectively
causing all Redis*Backends to write to the same database.

The RedisSessionBackend uses the pconnect method by default and
therefore requires this fix in order to distinguish FE and BE
backends correctly, if both are stored within a Redis database.

The pconnect is optional for the cache RedisBackend, but we still
use the database number now for the persistent_id parameter.

Review

  • Code review CR +2 Done
    • Frank Nägler +2
    • Oliver Klee +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Frank Nägler +2
    • Andreas Kienast +1
    • TYPO3com +1 CI

Issues 1

Files 2

Review log 1317

  1. Markus Klein uploaded patch set 1 07/31/19, 00:07

  2. Markus Klein updated the commit message in patch set 2 07/31/19, 00:09

  3. TYPO3com voted on patch set 1 V +1 07/31/19, 00:19 Completed build in 11m 46s on Wed, 31 Jul, 12:19 AM Test Summary: 47160 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35396

  4. Markus Klein uploaded patch set 3 07/31/19, 00:21

  5. TYPO3com voted on patch set 2 V +1 07/31/19, 00:21 Completed build in 12m 17s on Wed, 31 Jul, 12:21 AM Test Summary: 47160 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35397

  6. TYPO3com voted on patch set 3 V +1 07/31/19, 00:32 Completed build in 10m 49s on Wed, 31 Jul, 12:32 AM Test Summary: 47160 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35398

  7. Jonas Eberle commented on patch set 3 V +1 CR +1 07/31/19, 12:28

    Tested with PHP 7.3 and ext-redis 4.3.0. I have 2 Redis instances and use different databases: TYPO3_CONF_VARS__SYS__session__BE__backend=TYPO3\CMS\Core\Session\Backend\RedisSessionBackend TYPO3_CONF_VARS__SYS__session__BE__options__hostname=redis TYPO3_CONF_VARS__SYS__session__BE__options__database=0 TYPO3_CONF_VARS__SYS__session__FE__backend=TYPO3\CMS\Core\Session\Backend\RedisSessionBackend TYPO3_CONF_VARS__SYS__session__FE__options__hostname=redis TYPO3_CONF_VARS__SYS__session__FE__options__database=1 TYPO3_CONF_VARS__SYS__caching__cacheConfigurations__cache_hash__backend=TYPO3\CMS\Core\Cache\Backend\RedisBackend TYPO3_CONF_VARS__SYS__caching__cacheConfigurations__cache_hash__options__hostname=redis2 TYPO3_CONF_VARS__SYS__caching__cacheConfigurations__cache_hash__options__database=3 ... -> I can confirm that entries are made on the correct instance and with the correct database. I was able to reproduce the bug with FE/BE sessions and this fixes it. Thank you!
  8. Andreas Kienast voted on patch set 3 CR +1 07/31/19, 13:49

  9. Frank Nägler commented on patch set 3 CR -1 08/06/19, 13:48

    RedisBackend.php:158 Unresolved

    $this->database is an integer, but the pconnect method is annotated to expect a string value. The method has no type hint, but to be future ready, I would add a string cast here to ensure a string and to be consistent.
  10. Frank Nägler commented on patch set 4 08/06/19, 13:52

    Published edit on patch set 3.
  11. Frank Nägler voted on patch set 4 V +1 CR +1 08/06/19, 13:54

  12. TYPO3com voted on patch set 4 V +1 08/06/19, 14:03 Completed build in 10m 32s on Tue, 6 Aug, 02:03 PM Test Summary: 47172 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35614

  13. Oliver Klee voted on patch set 4 CR +1 08/06/19, 15:12

  14. Andreas Kienast voted on patch set 4 CR +1 08/07/19, 10:01

  15. Frank Nägler voted on patch set 4 V +2 CR +2 08/07/19, 10:29

  16. Andreas Kienast voted on patch set 4 V +1 08/07/19, 10:29

  17. Frank Nägler merged patch set 5 08/07/19, 10:29