Skip to content
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

[Bug] Import stales when error in one import data record #232

Closed
fashxp opened this issue Jul 20, 2022 · 3 comments · Fixed by #308
Closed

[Bug] Import stales when error in one import data record #232

fashxp opened this issue Jul 20, 2022 · 3 comments · Fixed by #308
Assignees
Labels

Comments

@fashxp
Copy link
Member

fashxp commented Jul 20, 2022

Expected behavior

To be discussed

Actual behavior

For example, I get following error in the logs:

 CRITICAL  [messenger] Error thrown while handling message Pimcore\Bundle\DataImporterBundle\Messenger\DataImporterMessage. Removing from transport after 3 retries. Error: "Handling "Pimcore\Bundle\DataImporterBundle\Messenger\DataImporterMessage" failed: Pimcore\Bundle\DataImporterBundle\Tool\DataObjectLoader::loadByAttribute(): Argument #3 ($identifier) must be of type string, null given, called in /var/www/html/dev/pimcore/data-importer/src/Resolver/Load/AttributeStrategy.php on line 70" ["class" => "Pimcore\Bundle\DataImporterBundle\Messenger\DataImporterMessage","retryCount" => 3,"error" => "Handling "Pimcore\Bundle\DataImporterBundle\Messenger\DataImporterMessage" failed: Pimcore\Bundle\DataImporterBundle\Tool\DataObjectLoader::loadByAttribute(): Argument #3 ($identifier) must be of type string, null given, called in /var/www/html/dev/pimcore/data-importer/src/Resolver/Load/AttributeStrategy.php on line 70","exception" => Symfony\Component\Messenger\Exception\HandlerFailedException { …}]

no messages in application log, but import is stuck as tmp-store worker entry is not cleared properly.

Steps to reproduce

import CSV/xls with empty rows

@fashxp fashxp added the Bug label Jul 20, 2022
@mcop1 mcop1 self-assigned this Feb 13, 2023
@mcop1
Copy link
Contributor

mcop1 commented Feb 16, 2023

I could reproduce the problem, a possible solution could be:

We could catch the exception either directly in processQueueItems method or in the methods that are calling processQueueItems. Log the exception message to the application logger.

We could introduce a flag "continue on error" which is set by default. If the flag is set, we catch and log the exception, after that continue with the next row. If it is not set, we catch and log the exception, after that stop import. This could be important if you have imports or rows that are depended of each other (e.g. parent child relations).
Or maybe we could even decide this based on which process configuration was set (parallel or sequential). But a flag/checkbox would be the most flexible option.

@mcop1
Copy link
Contributor

mcop1 commented Feb 17, 2023

See #263 (comment) for more information on replicating the issue.

@mcop1
Copy link
Contributor

mcop1 commented Feb 23, 2023

I could reproduce the problem, a possible solution could be:

We could catch the exception either directly in processQueueItems method or in the methods that are calling processQueueItems. Log the exception message to the application logger.

We could introduce a flag "continue on error" which is set by default. If the flag is set, we catch and log the exception, after that continue with the next row. If it is not set, we catch and log the exception, after that stop import. This could be important if you have imports or rows that are depended of each other (e.g. parent child relations). Or maybe we could even decide this based on which process configuration was set (parallel or sequential). But a flag/checkbox would be the most flexible option.

Implement:

  • Add exception for the mentioned error
  • Catch all exceptions in processQueueItem and remove the row from the queue table

Follow up feature:
#307

@mcop1 mcop1 linked a pull request Feb 27, 2023 that will close this issue
robertSt7 pushed a commit that referenced this issue Mar 1, 2023
* [Bug] Import stales when error in one import data record #232

* Apply php-cs-fixer changes

---------

Co-authored-by: mcop1 <[email protected]>
@mcop1 mcop1 closed this as completed Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants