Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cache] CacheItem with tag is never a hit after expired once #36458

Closed
alexander-schranz opened this issue Apr 15, 2020 · 3 comments
Closed

[Cache] CacheItem with tag is never a hit after expired once #36458

alexander-schranz opened this issue Apr 15, 2020 · 3 comments

Comments

@alexander-schranz
Copy link
Contributor

alexander-schranz commented Apr 15, 2020

Symfony version(s) affected: 4.4.0 -> 4.4.7

Description

If a CacheItem with a Tag is expired once and be rewritten with a new expiredAfter it is never again a hit.

How to reproduce

#36457

Possible Solution

Can sadly not provide a solution as I'm not sure where the error is.

Additional context

Without tags it works as expected.

Also when using the older TagAwareAdapter( instead of the optimized FilesystemTagAwareAdapter it works as expected so it need to be in the TagAwareTraitAdapters as the following tests are effected:

1) Symfony\Component\Cache\Tests\Adapter\FilesystemTagAwareAdapterTest::testRefreshAfterExpires

Failed asserting that false is true.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:194

2) Symfony\Component\Cache\Tests\Adapter\PredisTagAwareClusterAdapterTest::testRefreshAfterExpires

Failed asserting that true is false.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:183

3) Symfony\Component\Cache\Tests\Adapter\RedisTagAwareAdapterTest::testRefreshAfterExpires

Failed asserting that true is false.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:183

4) Symfony\Component\Cache\Tests\Adapter\RedisTagAwareClusterAdapterTest::testRefreshAfterExpires

Failed asserting that true is false.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:183
@nicolas-grekas
Copy link
Member

/cc @andrerom maybe you'd like to have a look?

@andrerom
Copy link
Contributor

andrerom commented Apr 17, 2020

Stuck with a cold right now, so can't promise anything there.

@xabbuh
Copy link
Member

xabbuh commented Apr 18, 2020

@andrerom Take care of yourself and get well soon! :)

nicolas-grekas added a commit that referenced this issue Apr 19, 2020
…lexander-schranz, nicolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] CacheItem with tag is never a hit after expired

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes/no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #36458
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

It seems like a tag cacheItem is never a hit again. Not sure how fix this but the cache component is really hard to debug 🙈 .

It need to be somewhere generally as all TagAware caches are effected:

```
1) Symfony\Component\Cache\Tests\Adapter\FilesystemTagAwareAdapterTest::testRefreshAfterExpires

Failed asserting that false is true.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:194

2) Symfony\Component\Cache\Tests\Adapter\PredisTagAwareClusterAdapterTest::testRefreshAfterExpires

Failed asserting that true is false.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:183

3) Symfony\Component\Cache\Tests\Adapter\RedisTagAwareAdapterTest::testRefreshAfterExpires

Failed asserting that true is false.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:183

4) Symfony\Component\Cache\Tests\Adapter\RedisTagAwareClusterAdapterTest::testRefreshAfterExpires

Failed asserting that true is false.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:183
```

Commits
-------

d082eca Add reproducer to for hit after update expire cacheItem
f815b01 [Cache] fix FilesystemTagAwareAdapter failing when a tag link preexists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants