-
Notifications
You must be signed in to change notification settings - Fork 47
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
Kernel is not registered in Worker #45
Comments
@stingus can you provide the code I need to reproduce the error? |
Not my actual setup but it reproduces the error: use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Voryx\ThruwayBundle\Annotation\Register;
use Voryx\ThruwayBundle\Annotation\Worker;
/**
* @Worker("worker", maxProcesses="1")
*/
class Test extends Controller
{
/**
* @Register("test")
*/
public function testAction()
{
$this->get('templating')->render('@AppBundle/Mail/body.html.twig');
}
} I'm calling the templating service, which loads twig, which loads file_locator service. The last one crashes when it injects the kernel, which is not present in the container. |
Did anything further happen with this issue, we are experiencing the same issue with Symfony 2.8.13 ... The first call to $this->get('kernel') from inside the ThruwayBundle seems to result in calling the appDevProjectContainer getKernelService which throws the exception but unsure why this would be Originally thought this might be an issue with Symfony under certain circumstances (It seems like loading the Bundle into a vanilla Symfony install doesn't have the issue). |
I just had a similar problem /**
* @Register("test")
*/
public function testAction()
{
$firstUser = $this->get('sonata.user.manager.user')->find(1);
// the process will hang there, not able to do shit
return ['this is never returned'];
} I think this may be related to some errors in yml configs, unrelated with ThruwayBundle, making some services unavailable from a ContainerAwareCommand |
I can't remember the exact details of this because it was so long ago. I can tell you that the issue we had was because we had dependencies on services that injected |
Same here, I tried with symfony 2.8.12 and 2.8.28 "voryx/thruway": "^0.4.2",
"voryx/thruway-bundle": "dev-master", as soon as I do from a worker/RPC: $this->get('templating')->render('@........html.twig'); // Email template I get
This is quite frustrating so far I am unable to find the exact cause, I am digging into vendor/voryx/thruway-bundle/src/Voryx/ThruwayBundle/DependencyInjection/Compiler/AnnotationConfigurationPass.php:56 if ($class->implementsInterface('Symfony\Component\DependencyInjection\ContainerAwareInterface')) {
$container->setDefinition($serviceId, $definition)
->addMethodCall('setContainer', [new Reference('thruway_container')]);
} else {
$container->setDefinition($serviceId, $definition);
} Replacing |
I have a worker which throws the following exception: "You have requested a synthetic service ("kernel")". The DIC does not know how to construct this service.". After some debugging, it seems that the container used in the worker controller does not have the "kernel" service registered. The thruway_client service has the kernel service, but is not available in the controller. The kernel service is required by the file locator service in the appProdProjectContainer.php:
Any ideas how to avoid this issue?
The text was updated successfully, but these errors were encountered: