Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

The service "sonata.block.renderer.traceable" has a dependency on a non-existent service "debug.stopwatch" #60

Closed
dkorsak opened this Issue · 19 comments

6 participants

@dkorsak

Error is in the command line during clear symfony cache file.

I have latest Symfony 2.2.x dev version in my composer file and dev-master of SonataBlockBundle.

This happened after update Symfony by composer to latest dev version

@lsmith77
Owner

do you not have the WebProfilerBundle enabled?

@lsmith77
Owner

hmm reading the code it shouldnt matter:

        if (!$config['profiler']['enabled']) {
            $container->setAlias('sonata.block.renderer', 'sonata.block.renderer.default');

            $container->removeDefinition('sonata.block.renderer.traceable');

            return;
        }
@lsmith77
Owner

ah .. imho this should additionally check if the bundle is enabled similar to how we check for the SonataAdminBundle here https://github.com/symfony-cmf/MenuBundle/blob/master/DependencyInjection/SymfonyCmfMenuExtension.php#L70

@dkorsak

Yes I have WebProfilerBundle enabled

Service debug.stopwatch is visible in command line (app/console container:debug)

@lsmith77
Owner

i assume you have tried to manually clear your cache?

@dkorsak

yes

@lsmith77
Owner

for the correct environment? the error message you pasted simply cannot happen if you do have the debug.stopwatch service. so this doesnt point to an issue in the bundle per se but rather that there is some inconsistency.

@smoove

I have the same problem, in the dev environment, everything works fine, in the prod environment the above error is thrown.

Also when clearing the cache, this one works:
app/console cache:clear --env=prod

This one triggers the error:
app/console cache:clear --env=prod --no-debug

I guess the stopwatch service is not available in the prod environment.

@lsmith77
Owner

aha! .. so you dont have the profiler enabled but you do have profiling enabled in sonata block bundle.

@lsmith77
Owner

but this is a bit trickier to check for without a compiler pass. i can submit a fix that makes the service optional but it would still mean that people have profiling enabled without actually being able to profile

@smoove

I really don't understand. I use the block bundle "passively", as it's needed for sonata-admin. I did not "enable profiling" or configure anything related to the block bundle.

@lsmith77
Owner

profiling is enabled by default when you are in debug mode. however in prod it should be disabled and therefore this trace service shouldnt even be used. so from my point of view you either enabled debugging in prod or you did infact set profiling to enabled in the block bundle.

@lsmith77
Owner

at any rate .. can you try this PR #61 ?

@smoove

Yeah, that fixes it. I can clear the cache with "--no-debug" and the page does not throw the error in the prod environment anymore.

@dkorsak

Im waiting for merge PR

@rande
Owner

done

@rande rande closed this
@BraisGabin

The problem lies not in the console only: http://stackoverflow.com/q/16563442/842697

I fix it merging manually #61. How could I get the fix with composer? (Sorry if this is offtopic)

@Maxwell2022

Same here can you release 2.2.2 because this is an issue happening in production env?

@Maxwell2022

It's been fixed in 2.2.3, thanks ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.