Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

ServiceCircularReferenceException with BlockVarnishCache #192

Open
gonzalovilaseca opened this issue Jun 25, 2014 · 17 comments
Open

ServiceCircularReferenceException with BlockVarnishCache #192

gonzalovilaseca opened this issue Jun 25, 2014 · 17 comments

Comments

@gonzalovilaseca
Copy link

I'm trying to run Esi with CMF Block bundle, but I'm getting this exception:

ServiceCircularReferenceException: Circular reference detected for service "http_kernel", path: "http_kernel -> debug.event_dispatcher -> profiler -> sonata.block.templating.helper -> sonata.cache.manager -> cmf.block.cache.varnish -> fragment.handler -> fragment.renderer.inline".



    in /var/www/app/bootstrap.php.cache line 1951
    at Container->get('http_kernel') in /var/www/app/cache/dev/appDevDebugProjectContainer.php line 3666
    at appDevDebugProjectContainer->getFragment_Renderer_InlineService() in /var/www/app/bootstrap.php.cache line 1974
    at Container->get('fragment.renderer.inline') in /var/www/app/cache/dev/appDevDebugProjectContainer.php line 3602
    at appDevDebugProjectContainer->getFragment_HandlerService() in /var/www/app/bootstrap.php.cache line 1974
    at Container->get('fragment.handler') in /var/www/app/cache/dev/appDevDebugProjectContainer.php line 1106
    at appDevDebugProjectContainer->getCmf_Block_Cache_VarnishService() in /var/www/app/bootstrap.php.cache line 1974
    at Container->get('cmf.block.cache.varnish') in /var/www/app/cache/dev/appDevDebugProjectContainer.php line 6132
    at appDevDebugProjectContainer->getSonata_Cache_ManagerService() in /var/www/app/bootstrap.php.cache line 1974
    at Container->get('sonata.cache.manager', '2') in /var/www/app/cache/dev/appDevDebugProjectContainer.php line 14290
    at appDevDebugProjectContainer->getSonata_Block_Templating_HelperService() in /var/www/app/bootstrap.php.cache line 1974
    at Container->get('sonata.block.templating.helper') in /var/www/app/cache/dev/appDevDebugProjectContainer.php line 5414
    at appDevDebugProjectContainer->getProfilerService() in /var/www/app/bootstrap.php.cache line 1974
    at Container->get('profiler', '2') in /var/www/app/cache/dev/appDevDebugProjectContainer.php line 1680
    at appDevDebugProjectContainer->getDebug_EventDispatcherService() in /var/www/app/bootstrap.php.cache line 1974
    at Container->get('debug.event_dispatcher') in /var/www/app/cache/dev/appDevDebugProjectContainer.php line 3696
    at appDevDebugProjectContainer->getHttpKernelService() in /var/www/app/bootstrap.php.cache line 1974
    at Container->get('http_kernel') in /var/www/app/bootstrap.php.cache line 2251
    at Kernel->getHttpKernel() in /var/www/app/bootstrap.php.cache line 2247
    at Kernel->handle(object(Request)) in /var/www/web/app_dev.php line 42

cmf.block.cache.varnish needs fragment.handler.
The following call is done in a compiler pass on fragment.handler:

$instance->addRenderer($this->get('fragment.renderer.inline'));

And fragment.renderer.inline needs http_kernel, so a circular exception is raised.
Any ideas on how to solve it?

@gonzalovilaseca
Copy link
Author

It seems that the problem comes from the profiler, sonata block bundle adds sonata.block.templating.helper to the profiler data_collector, and that is the reason for the circular reference exception.
I'm going to look further into this.

@dbu
Copy link
Member

dbu commented Jun 27, 2014

thanks and good luck! please tell if you find something.

its pretty busy here, did not have time to look into it myself.

@Deamon
Copy link

Deamon commented Jul 8, 2014

Hello gonzalovilaseca,
did you manage to do something with this error?

@gonzalovilaseca
Copy link
Author

I haven't had the time to look further, I found that if you disable the data_collector in the sonata bundle, you can temporarily fix it. I have to look further..I just don't know when I'll have the time.
Are you getting this error too?

@Deamon
Copy link

Deamon commented Jul 8, 2014

I'm not not sure that it is exactly the same error but I also have a circular reference.
it append when i Upgrade sf2.1 to 2.3 solving all dependancies about sonata.

as the path is almost the same I was hopping that you solved it :-)

@Deamon
Copy link

Deamon commented Jul 16, 2014

@gonzalovilaseca I manage to isolate from where the problem was originate.

The BlockBundle add into the profiler a custom dataCollector to show the blocks list in the profiler.
If I disable this service, declared in the vendor sonataBlockBundle it works like a charm.

I'm looking deeper to see if I have in my app a service that would require a service required by the vendor service.

'sonata.block.data_collector' declared in: vendor/sonata-project/block-bundle/DependencyInjection/SonataBlockExtension.php

@dbu
Copy link
Member

dbu commented Jul 16, 2014

maybe the service that dataCollector service could be made lazy to solve the circularity issue?

@Deamon
Copy link

Deamon commented Jul 16, 2014

Thanks @dbu, I tried to set into the vendor definition to lazy but it didn't solve the circular reference.

@dbu
Copy link
Member

dbu commented Jul 16, 2014

does the problem also occur with only sonata cache and sonata block, without cmf block? or does sonata do some clever trick with their service that we could mimick?

@Deamon
Copy link

Deamon commented Jul 16, 2014

Actually I have no idea, I just get a full web app with a lot of bundles configured.
the app is to much integrate with CMF to be able to deactivate it. (mainly the order for routers between sf and sonata)

@dbu
Copy link
Member

dbu commented Jul 17, 2014

sorry, i also don't know enough why this starts to happen or what to do without digging deep into it - for which i unfortunately have no time at this point.

can you deactivate profiling in the sonata block bundle to break the circle?

@dbu
Copy link
Member

dbu commented Jul 17, 2014

@rmsint i think you originally added this. can you help us where this comes from? do you have any idea how to break the circle or where to look for the cause of that circle?

@Deamon
Copy link

Deamon commented Jul 17, 2014

Thanks for your reply,
I completely understand your lack of time, I already disable it in my dev vendors,
Until a possible answer or finding of the problem, do you think it could be possible to add a parameter to disable this dataCollector ?

@dbu
Copy link
Member

dbu commented Jul 20, 2014

that could make sense yes. but would need to be done in the sonata bundle, not here, right? you would have to ask rande for sonata, or just propose a PR.

@Deamon
Copy link

Deamon commented Jul 21, 2014

Oo That's right, I thought I was on it.
i'll try to do the PR as soon as I can Thanks for your answers.

@lsmith77
Copy link
Member

lsmith77 commented Aug 7, 2014

ping

@gonzalovilaseca
Copy link
Author

I haven't looked further, but this configuration disables de profiler listener:

sonata_block:
    profiler:
        #If the profiler is enabled a circular reference exception is launched
        enabled:        false
        container_types: ~

@lsmith77 lsmith77 added this to the 1.2 milestone Oct 2, 2014
@lsmith77 lsmith77 modified the milestones: 1.3, 1.2 Jun 17, 2015
@dbu dbu removed this from the 1.3 milestone Feb 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants