akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
954 stars 514 forks source link

Job not found in ComputeProductModelDescendantsSubscriber #11065

Closed msiemens closed 4 years ago

msiemens commented 4 years ago

I'm reporting a Bug

System info: akeneo-pim-system-info_2019-11-15_09_39 (1).txt

When updating products via the API, I got an Internal Server Error and the following log entry:

[2019-11-15 05:30:26] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Argument 1 passed to Akeneo\Tool\Bundle\BatchQueueBundle\Launcher\QueueJobLauncher::launch() must be an instance of Akeneo\Tool\Component\Batch\Model\JobInstance, null given, called in /home/pim/akeneo/releases/c948409eef1a88ebf8fbb702810e8065328441c6/vendor/akeneo/pim-community-dev/src/Akeneo/Pim/Enrichment/Bundle/EventSubscriber/ComputeProductModelDescendantsSubscriber.php on line 87" at /home/pim/akeneo/releases/c948409eef1a88ebf8fbb702810e8065328441c6/vendor/akeneo/pim-community-dev/src/Akeneo/Tool/Bundle/BatchQueueBundle/Launcher/QueueJobLauncher.php line 89 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Type error: Argument 1 passed to Akeneo\\Tool\\Bundle\\BatchQueueBundle\\Launcher\\QueueJobLauncher::launch() must be an instance of Akeneo\\Tool\\Component\\Batch\\Model\\JobInstance, null given, called in /home/pim/akeneo/releases/c948409eef1a88ebf8fbb702810e8065328441c6/vendor/akeneo/pim-community-dev/src/Akeneo/Pim/Enrichment/Bundle/EventSubscriber/ComputeProductModelDescendantsSubscriber.php on line 87 at /home/pim/akeneo/releases/c948409eef1a88ebf8fbb702810e8065328441c6/vendor/akeneo/pim-community-dev/src/Akeneo/Tool/Bundle/BatchQueueBundle/Launcher/QueueJobLauncher.php:89)"} []

From what I can see it seems like ComputeProductModelDescendantsSubscriber job fails to get the job instance and passes null to the job launcher:

https://github.com/akeneo/pim-community-dev/blob/af42d585410686eca3259c1fa88d02092d4b4b85/src/Akeneo/Pim/Enrichment/Bundle/EventSubscriber/ComputeProductModelDescendantsSubscriber.php#L84-L87

msiemens commented 4 years ago

Well, seems like the default entries in akeneo_batch_job_instance have been deleted by accident. Restoring them from a backup made everything work fine again. Still it might be better to print a proper error message and not fail with an Internal Server Error 🙂

Doodoune commented 4 years ago

Hi!

I closed this issue, feel free to reopen it if needed.

Regards,

msiemens commented 4 years ago

As I already commented, I think it would be nice to display a better error message if the default entries in the akeneo_batch_job_instance have been deleted. Could you pass on this request to the dev team?

Doodoune commented 4 years ago

This job can't be deleted through UI so only manual delete in the database or custom code can delete this job instance. Adding validation, in this case, is not necessary for the vanilla PIM in my opinion.