Error in CSV Import

OMK 4.0.2 | CSV Import 2.4.1
PHP Version 7.4.33 SAPI cgi-fcgi
MySQL Server Version 5.7.43 Client Version mysqlnd 7.4.33

Any cue to fix this error ?

In the past was running well with Object(Omeka\Job\DispatchStrategy\Synchronous

Thank you

2023-07-31T21:24:17+00:00 INFO (6): 18 items were updated (update): 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 523.
2023-07-31T21:24:17+00:00 ERR (3): PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘2-1’ for key ‘UNIQ_4689E2F116131EA549213EC’ in /home/patr5456/public_html/appnum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117
Stack trace:
#0 /home/patr5456/public_html/appnum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(117): PDOStatement->execute(NULL)
#1 /home/patr5456/public_html/appnum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php(179): Doctrine\DBAL\Driver\PDOStatement->execute(NULL)
#2 /home/patr5456/public_html/appnum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php(226): Doctrine\DBAL\Statement->execute(NULL)
#3 /home/patr5456/public_html/appnum/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(276): Doctrine\DBAL\Statement->executeStatement()
#4 /home/patr5456/public_html/appnum/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1128): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->executeInserts()
#5 /home/patr5456/public_html/appnum/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(425): Doctrine\ORM\UnitOfWork->executeInserts(Object(Doctrine\ORM\Mapping\ClassMetadata))
#6 /home/patr5456/public_html/appnum/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(392): Doctrine\ORM\UnitOfWork->commit(NULL)
#7 /home/patr5456/public_html/appnum/application/src/Api/Adapter/AbstractEntityAdapter.php(447): Doctrine\ORM\EntityManager->flush()
#8 /home/patr5456/public_html/appnum/application/src/Api/Manager.php(233): Omeka\Api\Adapter\AbstractEntityAdapter->update(Object(Omeka\Api\Request))
#9 /home/patr5456/public_html/appnum/application/src/Api/Manager.php(136): Omeka\Api\Manager->execute(Object(Omeka\Api\Request))
#10 /home/patr5456/public_html/appnum/modules/CSVImport/src/Job/Import.php(1210): Omeka\Api\Manager->update(‘csvimport_impor…’, 5, Array)
#11 /home/patr5456/public_html/appnum/modules/CSVImport/src/Job/Import.php(203): CSVImport\Job\Import->endJob()
#12 /home/patr5456/public_html/appnum/application/src/Job/DispatchStrategy/Synchronous.php(34): CSVImport\Job\Import->perform()
#13 /home/patr5456/public_html/appnum/application/src/Job/Dispatcher.php(105): Omeka\Job\DispatchStrategy\Synchronous->send(Object(Omeka\Entity\Job))
#14 /home/patr5456/public_html/appnum/application/src/Job/Dispatcher.php(91): Omeka\Job\Dispatcher->send(Object(Omeka\Entity\Job), Object(Omeka\Job\DispatchStrategy\Synchronous))
#15 /home/patr5456/public_html/appnum/modules/CSVImport/src/Controller/IndexController.php(160): Omeka\Job\Dispatcher->dispatch(‘CSVImport\Job\I…’, Array)
#16 /home/patr5456/public_html/appnum/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(71): CSVImport\Controller\IndexController->mapAction()
#17 /home/patr5456/public_html/appnum/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))
#18 /home/patr5456/public_html/appnum/vendor/laminas/laminas-eventmanager/src/EventManager.php(179): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))
#19 /home/patr5456/public_html/appnum/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(97): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))
#20 /home/patr5456/public_html/appnum/vendor/laminas/laminas-mvc/src/DispatchListener.php(132): Laminas\Mvc\Controller\AbstractController->dispatch(Object(Laminas\Http\PhpEnvironment\Request), Object(Laminas\Http\PhpEnvironment\Response))
#21 /home/patr5456/public_html/appnum/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent))
#22 /home/patr5456/public_html/appnum/vendor/laminas/laminas-eventmanager/src/EventManager.php(179): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))
#23 /home/patr5456/public_html/appnum/vendor/laminas/laminas-mvc/src/Application.php(325): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))
#24 /home/patr5456/public_html/appnum/index.php(21): Laminas\Mvc\Application->run()
#25 {main}

You’re using the Synchronous strategy. So, you had to enable this to get the import to work at all in the past?

Oh, one more question: it looks like the updates you ran the job to do actually got done. This error happened basically at the very end of the process when it was reporting results. Does that seem correct, that your changes actually went through?

The updates were not done. I was trying to input a dcterms:identifier for 18 items. Very strange to see the first line saying the job done !

I never look at the DispatchStrategy in the past. In another post you comment on this parameter, so I look in my config file to see that the strategy is Synchronous.

SN

Who’s your host? If they had a one-click install or something similar then they could have set that setting for you. It’s not the default setting we ship with, though.

I run 2 installations of OMKS on HostPapa Canada since 2017 ( one for production, the other for testing ).

I also run an installation on a local WampServer with the same parameters.

After each new update of OMKS I copy my local config file with the strategy Synchronous.

Here are my latest tests with CSVimport:

“action”: “create” | OK

“action”: “replace” | OK

“action”: “revise” | Error

“action”: “update” | Error

How do you read the second line ( Duplicate entry ‘2-1’ ) ? :

Integrity constraint violation: 1062 Duplicate entry ‘2-1’ for key ‘UNIQ_4689E2F116131EA549213EC’ in /home/patr5456/public_html/appnum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117

I also note this line of code in my config file

‘priority’ => \Zend\Log\Logger::NOTICE,

Should I change to

‘priority’ => \Laminas\Log\Logger::NOTICE,

OK. Do you have this same configuration, the Synchronous strategy, on your hosted installs, or is it just for your local copy?

As for the log priority line, Laminas is indeed the current way to write that. That won’t be related to your problem here though.

The Synchronous strategy is also on the hosted installs.

By the way, the actions revise & update were OK on the local Wampserver

Have you tried running with that setting commented out (two slashes // at the start of the line)?

The setting as you have it set makes jobs like imports run in the same request they get started in. The default is to run them as background jobs.

This error you’re seeing only comes up when you’re running “synchronously.” We’re looking into fixes for that problem, but if you can just run the import as a background job as is the default, that will also resolve the problem for you.

Without Strategy Synchronous here is the error

2023-08-03T11:11:09+00:00 ERR (3): Omeka\Job\Exception\RuntimeException: PHP-CLI error: invalid PHP path. in /home/patr5456/public_html/omkt/application/src/Job/DispatchStrategy/PhpCli.php:63

Stack trace:

#0 /home/patr5456/public_html/omkt/application/src/Job/Dispatcher.php(105): Omeka\Job\DispatchStrategy\PhpCli->send(Object(Omeka\Entity\Job))

#1 /home/patr5456/public_html/omkt/application/src/Job/Dispatcher.php(91): Omeka\Job\Dispatcher->send(Object(Omeka\Entity\Job), Object(Omeka\Job\DispatchStrategy\PhpCli))

#2 /home/patr5456/public_html/omkt/modules/CSVImport/src/Controller/IndexController.php(160): Omeka\Job\Dispatcher->dispatch(‘CSVImport\Job\I…’, Array)

#3 /home/patr5456/public_html/omkt/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(71): CSVImport\Controller\IndexController->mapAction()

#4 /home/patr5456/public_html/omkt/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))

#5 /home/patr5456/public_html/omkt/vendor/laminas/laminas-eventmanager/src/EventManager.php(179): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

The picture below resume my latest tests. Note that with the strategy synchronous the job are done with message Import as background.

For now I can manage my project without csvimport and I will wait for the next update.

Thank you for your comments

Okay, thanks for trying that. It’s possible your server does support background jobs, but that you need to find out what the path to the PHP CLI is on your server… that’s something you can fill in in the config file when PHP is not located in a “standard” location where we’re looking for it. This isn’t an uncommon situation on things like shared hosting that use cPanel and let you pick the PHP version.

It’s also possible your host just doesn’t provide the PHP CLI at all, you’d have to check with them to be sure.

I believe we have a fix in place that should avoid this issue when you’re using the Synchronous strategy; I’ll let you know when we have an updated version of CSV Import released that you can try out.

Okay, please try out the new 2.5.0 release of CSV Import (with the Synchonous strategy config line restored).

Actions Revise & Update are now working with the Synchronous strategy

Thank you John