data-importer
data-importer copied to clipboard
[Bug]: The "kernel" service is synthetic error when processing parallel
Expected behavior
datahub:data-importer:process-queue-parallel will properly process rows, or throw errors when there is a logic error
Actual behavior
Occasionally rows fail with the following error:
Error processing element: IMPORT,DATA,HERE The "kernel" service is synthetic, it needs to be set at boot time before it can be used.
This seems like a possible race condition as it seems to happen more when the server is under load by other tasks, but I might be imagining that.
Steps to reproduce
Inconsistent. Run lots of 10k, 100k, 1m row datahub imports with multiple parallel workers (8 in my case on 4 cores) while the server is under other workloads.
Sometimes there is no error, sometimes a few rows, and sometimes the whole import fails.
Thanks a lot for reporting the issue. We did not consider the issue as "Pimcore:Priority", "Pimcore:ToDo" or "Pimcore:Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.
I have the same issue.
Hi everyone,
is there something new in this? I also occur this error since a few days?
we are not able to reproduce it, see also thread here, which is a similar topic. any additional insights or debugging results are welcome.
@stephangmms it's happening when importing a large number of products with a large number of attributes we had more than 200+ attributes for each product.
@stephangmms it's happening when importing a large number of products with a large number of attributes we had more than 200+ attributes for each product.
that sounds familiar. Sadly i have not too much insight into that problem because i was out of this project for a while. I only know that the data-importer jobs (csv-imports, parallel execution) run in small scale test (<100 items) perfectly. Now as we are testing 5000+ products with only 3 attributes/product this problems occur.
[DATA-IMPORTER] Error processing element: 0695, --- DATA REMOVED FOR PRIVACY REASONS --- , Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The "kernel" service is synthetic, it needs to be set at boot time before it can be used. in /var/www/html/vendor/symfony/dependency-injection/Container.php:246
Pimcore: 11.3.0 DataHub: 1.7.2 Data-Importer: 1.9.0
I'm able to reproduce this with two bundles
- Data hub importer
- Data quality management
Stacktrace:
prod-error.log:3325:[2025-03-20T03:00:14.499398+00:00] DATA-IMPORTER.ERROR: Error processing element: Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The "kernel" service is synthetic, it needs to be set at boot time before it can be used. in /var/www/pimcore11/vendor/symfony/dependency-injection/Container.php:246 Stack trace:
#0 /var/www/pimcore11/vendor/symfony/dependency-injection/Container.php(211): Symfony\Component\DependencyInjection\Container::make()
#1 /var/www/pimcore11/var/cache/prod/ContainerNOPK04J/getInstaller10Service.php(36): Symfony\Component\DependencyInjection\Container->get()
#2 /var/www/pimcore11/var/cache/prod/ContainerNOPK04J/App_KernelProdContainer.php(896): ContainerNOPK04J\getInstaller10Service::do()
#3 /var/www/pimcore11/var/cache/prod/ContainerNOPK04J/getDataQualitySubscriberService.php(28): ContainerNOPK04J\App_KernelProdContainer->load()
#4 /var/www/pimcore11/var/cache/prod/ContainerNOPK04J/App_KernelProdContainer.php(896): ContainerNOPK04J\getDataQualitySubscriberService::do()
#5 /var/www/pimcore11/var/cache/prod/ContainerNOPK04J/App_KernelProdContainer.php(1732): ContainerNOPK04J\App_KernelProdContainer->load()
#6 /var/www/pimcore11/vendor/symfony/event-dispatcher/EventDispatcher.php(257): ContainerNOPK04J\App_KernelProdContainer::ContainerNOPK04J\{closure}()
#7 /var/www/pimcore11/vendor/symfony/event-dispatcher/EventDispatcher.php(220): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}()
#8 /var/www/pimcore11/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#9 /var/www/pimcore11/vendor/pimcore/pimcore/models/DataObject/Concrete.php(173): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#10 /var/www/pimcore11/vendor/pimcore/pimcore/models/DataObject/AbstractObject.php(552): Pimcore\Model\DataObject\Concrete->update()
#11 /var/www/pimcore11/vendor/pimcore/pimcore/models/DataObject/Concrete.php(637): Pimcore\Model\DataObject\AbstractObject->save()
#12 /var/www/pimcore11/vendor/pimcore/data-importer/src/Processing/ImportProcessingService.php(234): Pimcore\Model\DataObject\Concrete->save()
#13 /var/www/pimcore11/vendor/pimcore/data-importer/src/Processing/ImportProcessingService.php(148): Pimcore\Bundle\DataImporterBundle\Processing\ImportProcessingService->processElement()
#14 /var/www/pimcore11/vendor/pimcore/data-importer/src/Command/ParallelProcessQueueCommand.php(70): Pimcore\Bundle\DataImporterBundle\Processing\ImportProcessingService->processQueueItem()
#15 /var/www/pimcore11/vendor/webmozarts/console-parallelization/src/ParallelExecutor.php(250): Pimcore\Bundle\DataImporterBundle\Command\ParallelProcessQueueCommand->runSingleCommand()
#16 /var/www/pimcore11/vendor/webmozarts/console-parallelization/src/ParallelExecutor.php(229): Webmozarts\Console\Parallelization\ParallelExecutor->runTolerantSingleCommand()
#17 /var/www/pimcore11/vendor/webmozarts/console-parallelization/src/ParallelExecutor.php(202): Webmozarts\Console\Parallelization\ParallelExecutor->processItems()
#18 /var/www/pimcore11/vendor/webmozarts/console-parallelization/src/ParallelExecutor.php(85): Webmozarts\Console\Parallelization\ParallelExecutor->executeChildProcess()
#19 /var/www/pimcore11/vendor/webmozarts/console-parallelization/src/Parallelization.php(142): Webmozarts\Console\Parallelization\ParallelExecutor->execute()
#20 /var/www/pimcore11/vendor/symfony/console/Command/Command.php(326): Pimcore\Bundle\DataImporterBundle\Command\ParallelizationAbstractCommand->execute()
#21 /var/www/pimcore11/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
#22 /var/www/pimcore11/vendor/symfony/framework-bundle/Console/Application.php(126): Symfony\Component\Console\Application->doRunCommand()
#23 /var/www/pimcore11/vendor/symfony/console/Application.php(324): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand()
#24 /var/www/pimcore11/vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun()
#25 /var/www/pimcore11/vendor/symfony/console/Application.php(175): Symfony\Bundle\FrameworkBundle\Console\Application->doRun()
#26 /var/www/pimcore11/bin/console(49): Symfony\Component\Console\Application->run()
It seems like there is a listener on save object from data quality mangment which tries to create Installer.php service but fails for the second argument Bundle interface. As when it compiles it tries to get bundle from the kernel
$container->get('kernel'))->getBundle("PimcoreDataQualityManagementBundle")
Compiled installer code:
GNU nano 6.2 /var/www/pimcore11/var/cache/prod/ContainerNOPK04J/getInstaller10Service.php
<?php
namespace ContainerNOPK04J;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
/*
* @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getInstaller10Service extends App_KernelProdContainer
{
/*
* Gets the public 'Pimcore\Bundle\DataQualityManagementBundle\Installer' shared autowired service.
*
* @return \Pimcore\Bundle\DataQualityManagementBundle\Installer
*/
public static function do($container, $lazyLoad = true)
{
include_once \dirname(__DIR__, 4).'/vendor/pimcore/pimcore/lib/Extension/Bundle/Installer/InstallerInterface.php';
include_once \dirname(__DIR__, 4).'/vendor/pimcore/pimcore/lib/Extension/Bundle/Installer/AbstractInstaller.php';
include_once \dirname(__DIR__, 4).'/vendor/pimcore/pimcore/lib/Extension/Bundle/Installer/SettingsStoreAwareInstaller.php';
include_once \dirname(__DIR__, 4).'/vendor/pimcore/data-quality-management-bundle/src/Installer.php';
include_once \dirname(__DIR__, 4).'/vendor/doctrine/migrations/src/MigrationsRepository.php';
include_once \dirname(__DIR__, 4).'/vendor/pimcore/pimcore/lib/Migrations/FilteredMigrationsRepository.php';
include_once \dirname(__DIR__, 4).'/vendor/doctrine/migrations/src/Metadata/Storage/MetadataStorage.php';
include_once \dirname(__DIR__, 4).'/vendor/pimcore/pimcore/lib/Migrations/FilteredTableMetadataStorage.php';
$a = ($container->services['doctrine.dbal.default_connection'] ?? self::getDoctrine_Dbal_DefaultConnectionService($container));
if (isset($container->services['Pimcore\\Bundle\\DataQualityManagementBundle\\Installer'])) {
return $container->services['Pimcore\\Bundle\\DataQualityManagementBundle\\Installer'];
}
$container->services['Pimcore\\Bundle\\DataQualityManagementBundle\\Installer'] = $instance = new \Pimcore\Bundle\DataQualityManagementBundle\Installer($a, ($container->services['kernel'] ?? $container->get('kernel'))->getBundle("PimcoreDataQualityManagementBundle"), [($container->services['Pimcore\\Bundle\\ApplicationLoggerBund>
$instance->setMigrationRepository(($container->services['Pimcore\\Migrations\\FilteredMigrationsRepository'] ??= new \Pimcore\Migrations\FilteredMigrationsRepository()));
$instance->setTableMetadataStorage(($container->services['Pimcore\\Migrations\\FilteredTableMetadataStorage'] ??= new \Pimcore\Migrations\FilteredTableMetadataStorage()));
$instance->setDependencyFactory(($container->privates['doctrine.migrations.dependency_factory'] ?? $container->load('getDoctrine_Migrations_DependencyFactoryService')));
return $instance;
}
}
thx for the additional findings. how does your Pimcore setup exactly look like? which bundles have you installed? in which order are they activated in bundles.php?
I have the same issue
This seems like a possible race condition as it seems to happen more when the server is under load by other tasks, but I might be imagining that.
yeah same case with me
For people reporting the '"kernel" service is synthetic' error, are you using the Command or Symfony Messenger based Importer?
@cancan101
I am using the Command-based, and have a cron job on the server for executing this command every 5 minutes
bin/console datahub:data-importer:process-queue-parallel
when you do symfony messenger based imports this problem doesn't appear?
This might be the upstream / root issue: https://github.com/webmozarts/console-parallelization/issues/294
@fashxp when we used the symfony messenger approach, we did not see the error; however, the import never finished. It got stuck most of the way complete. I am not 100% sure where to look for the kernel errors (did not see in the prod.err, application logger or the supervisord log).
Update Our root issue was an encoding issue in the CSV file. The encoding issue caused the sequential importer and symfony messenger to hang and triggered the kernel error in the parallel command importer.
related https://github.com/pimcore/data-importer/issues/466
see https://github.com/orgs/pimcore/discussions/18412
could you guys please double check if https://github.com/pimcore/pimcore/pull/18413 fixes the issue for you as well? thx very much!
Closing for now, since https://github.com/pimcore/pimcore/pull/18413 in pimcore/pimcore:12.0.1 probably fixes this. If not, please come back...