Jump to content

Prestashopdatabaseexception Error While Uploading Csv


Recommended Posts

Hello everybody, from a couple of days I receive the following error while trying to upload a csv file. Can you help me out?

 

[PrestaShopDatabaseException]

Deadlock found when trying to get lock; try restarting transaction
 

        INSERT INTO `ps_product_tag` (`id_tag`, `id_product`, `id_lang`)
        VALUES (1,43,1),(22981,43,1),(387,43,1),(22982,43,1)

at line 791 in file classes/db/Db.php

 

786. if ($webservice_call && $errno) {
787. $dbg = debug_backtrace();
788. WebserviceRequest::getInstance()->setError(500, '
 '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
789. } elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) {
790. if ($sql) {
791. throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
792. }
793.
794. throw new PrestaShopDatabaseException($this->getMsgError());
795. }
796. }
  • DbCore->displayError - [line 425 - classes/db/Db.php] - [1 Arguments]
    420. $this->result = $this->_query($sql);
    421. }
    422. }
    423.
    424. if (_PS_DEBUG_SQL_) {
    425. $this->displayError($sql);
    426. }
    427.
    428. return $this->result;
    429. }
    430.
  • DbCore->query - [line 601 - classes/db/Db.php] - [1 Arguments]
    596. {
    597. if ($sql instanceof DbQuery) {
    598. $sql = $sql->build();
    599. }
    600.
    601. $this->result = $this->query($sql);
    602. if ($use_cache && $this->is_cache_enabled) {
    603. Cache::getInstance()->deleteQuery($sql);
    604. }
    605.
    606. return (bool)$this->result;
  • DbCore->execute - [line 131 - classes/Tag.php] - [1 Arguments]
    126. }
    127. $data = rtrim($data, ',');
    128.
    129. $result = Db::getInstance()->execute('
    130.         INSERT INTO `'._DB_PREFIX_.'product_tag` (`id_tag`, `id_product`, `id_lang`)
    131.         VALUES '.$data);
    132.
    133. if ($list != array()) {
    134. self::updateTagCount($list);
    135. }
    136.
  • TagCore::addTags - [line 1796 - controllers/admin/AdminImportController.php] - [4 Arguments]
    1791. foreach ($tags as $one_tag) {
    1792. $str .= $one_tag.$this->multiple_value_separator;
    1793. }
    1794. $str = rtrim($str, $this->multiple_value_separator);
    1795.
    1796. $is_tag_added = Tag::addTags($key, $product->id, $str, $this->multiple_value_separator);
    1797. if (!$is_tag_added) {
    1798. $this->addProductWarning(Tools::safeOutput($info['name']), (int)$product->id, 'Invalid tag(s) ('.$str.')');
    1799. break;
    1800. }
    1801. }
  • AdminImportControllerCore->productImport - [line 3503 - controllers/admin/AdminImportController.php]
    3498. case $this->entities[$import_type = $this->l('Categories')]:
    3499. $this->categoryImport();
    3500. $this->clearSmartyCache();
    3501. break;
    3502. case $this->entities[$import_type = $this->l('Products')]:
    3503. $this->productImport();
    3504. $this->clearSmartyCache();
    3505. break;
    3506. case $this->entities[$import_type = $this->l('Customers')]:
    3507. $this->customerImport();
    3508. break;
  • AdminImportControllerCore->postProcess - [line 178 - classes/controller/Controller.php]
    173. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
    174. $this->setMedia();
    175. }
    176.
    177. // postProcess handles ajaxProcess
    178. $this->postProcess();
    179.
    180. if (!empty($this->redirect_after)) {
    181. $this->redirect();
    182. }
    183.
  • ControllerCore->run - [line 367 - classes/Dispatcher.php]
    362. if (isset($params_hook_action_dispatcher)) {
    363. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
    364. }
    365.
    366. // Running controller
    367. $controller->run();
    368. } catch (PrestaShopException $e) {
    369. $e->displayMessage();
    370. }
    371. }
    372.
  • DispatcherCore->dispatch - [line 58 - admin/index.php]
    53. if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab'])) {
    54. $_REQUEST['controller'] = strtolower($_REQUEST['tab']);
    55. }
    56.
    57. // Prepare and trigger admin dispatcher
    58. Dispatcher::getInstance()->dispatch();
Link to comment
Share on other sites

Hmmz the code itself looks safe.

 

Do you use MySQL 5.7? You'd better downgrade to 5.6, because 5.7 isn't supported yet.

 

IMO it must be something related to a hidden 504 error, because it alternates with this one, but I'm not sure. The good thing is the products list get updated anyway. Another possibility may be the tags creation process called by the query, but again I don't know...

 

SQL version is 5.5.48cll

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...