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

type: service caches are broken in 2.4 #1348

Closed
alexander-schranz opened this issue May 19, 2021 · 13 comments
Closed

type: service caches are broken in 2.4 #1348

alexander-schranz opened this issue May 19, 2021 · 13 comments
Assignees
Milestone

Comments

@alexander-schranz
Copy link
Contributor

alexander-schranz commented May 19, 2021

I currently did test @sulu against current dev dependencies and we have the following configured in the prod/doctrine.yaml:

doctrine.yaml
doctrine:
    orm:
        auto_generate_proxy_classes: false
        metadata_cache_driver:
            type: service
            id: doctrine.system_cache_provider
        query_cache_driver:
            type: service
            id: doctrine.system_cache_provider
        result_cache_driver:
            type: service
            id: doctrine.result_cache_provider

services:
    doctrine.result_cache_provider:
        class: Symfony\Component\Cache\DoctrineProvider
        public: false
        arguments:
            - '@doctrine.result_cache_pool'
    doctrine.system_cache_provider:
        class: Symfony\Component\Cache\DoctrineProvider
        public: false
        arguments:
            - '@doctrine.system_cache_pool'

framework:
    cache:
        pools:
            doctrine.result_cache_pool:
                adapter: cache.app
            doctrine.system_cache_pool:
                adapter: cache.system

You have requested a non-existent service "doctrine.system_cache_provider".

https://github.com/sulu/sulu/runs/2620361693

I think maybe there was a bc break introduced in the current current dev version, so I thought I will report this here. Updating the doctrine.yaml to something newer like this did fix it for us:

doctrine.yaml
doctrine:
    orm:
        auto_generate_proxy_classes: false
        metadata_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
        query_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
        result_cache_driver:
            type: pool
            pool: doctrine.result_cache_pool

framework:
    cache:
        pools:
            doctrine.result_cache_pool:
                adapter: cache.app
            doctrine.system_cache_pool:
                adapter: cache.system

So its not an issue for us currently as we did update the skeleton some time ago just thought I would report it that there was unexpected change which could maybe crash older projects an older cache configuration.

@stof
Copy link
Member

stof commented May 19, 2021

@alcaeus we should re-add the doctrine.system_cache_provider service as a deprecated one to avoid breaking existing apps

@alcaeus
Copy link
Member

alcaeus commented May 20, 2021

@alexander-schranz can you please test the current stable release with the same config? While we did make changes to metadata caching, I fail to see how those would be responsible for having a service disappear, let alone a service that you defined yourself.

The original config is from the early days of symfony/cache when the bundle didn't support creating the provider service itself. The second config is what we introduced a couple of years ago when we removed configuring doctrine/cache in this bundle.

Note that with the latest version, the metadata_cache_driver config is deprecated in favour of automatic configuration (ArrayAdapter when kernel.debug is enabled, PhpArrayAdapter otherwise).

@TomasVotruba
Copy link

TomasVotruba commented May 23, 2021

Hi, I just came across this error on dev upgrade to 2.4-dev: here is the failed GitHub Action build - https://github.com/rectorphp/getrector.org/pull/329/checks?check_run_id=2650545486

@alexander-schranz Thanks for sharing the solution 👍
I'm trying to figure out what exactly have you changed...

...(20 commits later), so here is the diff that works ✔️

image

In our case we had to change config/packages/prod/doctrine.php

https://github.com/rectorphp/getrector.org/pull/329/files#diff-b6ffdd83e5d44e8e8b8f71db29813538d227f74f0b2f4c0f9f8a5c8242bf5707

@ostrolucky
Copy link
Member

Hmm so 2.4 actually breaks any type: service types of caches completely, which is a serious regression. I've added failing test case at #1350. Thx for reports!

@ostrolucky ostrolucky added this to the 2.4.0 milestone May 23, 2021
@ostrolucky ostrolucky changed the title Service "doctrine.system_cache_provider" does not longer exist type: service caches are broken in 2.4 May 23, 2021
@alexander-schranz
Copy link
Contributor Author

@alcaeus the current released versions didn't make any problems for me yet.

@TomasVotruba
Copy link

TomasVotruba commented May 23, 2021

@alexander-schranz We're talking about 2.4 (dev to this day), as in the issue title.

@alcaeus
Copy link
Member

alcaeus commented May 24, 2021

@alexander-schranz thanks for following up. I'll take a look and go from there.

@TomasVotruba
Copy link

@alexander-schranz Ah, sorry, I missed you're the author of this issue :D my bad.

@alcaeus
Copy link
Member

alcaeus commented May 24, 2021

@TomasVotruba did you have the same config as others where you define the doctrine.system_cache_provider service yourself? Just making sure before I start digging in the wrong direction.

@ostrolucky
Copy link
Member

I'll answer for him. Yes, he does. That's how I created my failing test case/reproducer.

@simivar
Copy link

simivar commented May 27, 2021

Just so there is connection and nobody is lost: work is in progress in #1352

@TomasVotruba
Copy link

@ostrolucky 👍

@alcaeus Yes, I've linked the exact diff in my comment. You can see what was before/after: https://github.com/rectorphp/getrector.org/pull/329/files#diff-b6ffdd83e5d44e8e8b8f71db29813538d227f74f0b2f4c0f9f8a5c8242bf5707

@ostrolucky
Copy link
Member

Would be great if somebody could try out #1352

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

6 participants