Open
Description
Hi,
when one of the items is throwing an error, the standard error handler kicks in and is resetting the container in the child process.
This leads to the kernel not being available in the container any more. As the kernel is a synthetic service and initialises itself during boot()
, it's not available any more after a container reset in the error handler.
Any subsequent access to the kernel
service throws the following exception:
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The "kernel" service is synthetic, it needs to be set at boot time before it can be used.
Options to reproduce:
- Either enable the Symfony Profiler and provoke any error in one of the items to process. Stopwatch is accessing the kernel in
console.terminate
and thus throws the exception. - Or add some LOC for testing and access the
kernel
directly, for example directly after the container has been reset inResetServiceErrorHandler
:
public function handleError(string $item, Throwable $throwable, Logger $logger): int
{
$this->resettable->reset();
try {
$this->resettable->get('kernel');
} catch (\Throwable $e) {
dd($e->getMessage());
}
return $this->decoratedErrorHandler->handleError($item, $throwable, $logger);
}
Output: "The "kernel" service is synthetic, it needs to be set at boot time before it can be used."
Best regards!
Tim
Metadata
Metadata
Assignees
Labels
No labels