Results 1 to 9 of 9
  1. #1
    Join Date
    May 2006
    Posts
    18
    Plugin Contributions
    0

    help question [Done v1.3.6] Caching Error db_cache table

    Yesterday, I got error as:
    1062 Duplicate entry 'zc_7eb4ed1f36d90140477d9474b61e0e26' for key 1
    in:
    [insert into zen_db_cache set cache_entry_name = 'zc_7eb4ed1f36d90140477d9474b61e0e26', cache_data = 'a:568:{i:0;a:2:{s:6:\"cfgkey\";s:10:\"STORE_NAME\";s:8:\"cfgvalue\";s:13:\"Shop In Nepal\";}i:1;a:2:{s:6:\"cfgkey\";s:11:\"STORE_OWNER\";s:8:\"cfgvalue\";s:5:\"Akh il\";}i:2;a:2:{s:6:\"cfgkey\";s:13:\"STORE_COUNTRY\";s:8:\"cfgvalue\";s:3:\"149\ ";}i:3;a:2:{s:6:\"cfgkey\";s:10:\"STORE_ZONE\";s:8:\"cfgvalue\";s:1:\"1\";}i:4;a :2:{s:6:\"cfgkey\";s:22:\"EXPECTED_PRODUCTS_SORT\";s:8:\"cfgvalue\";s:4:\"desc\" ;}i:5;a:2:{s:6:\"cfgkey\";s:23:\"EXPECTED_PRODUCTS_FIELD\";s:8:\"cfgvalue\";s:13 :\"date_expected\";}i:6;a:2:{s:6:\"cfgkey\";s:29:\"USE_DEFAULT_LANGUAGE_CURRENCY \";s:8:\"cfgvalue\";s:5:\"false\";}i:7;a:2:{s:6:\"cfgkey\";s:25:\"LANGUAGE_DEFAU LT_SELECTOR\";s:8:\"cfgvalue\";s:7:\"Default\";}i:8;a:2:{s:6:\"cfgkey\";s:27:\"S EARCH_ENGINE_FRIENDLY_URLS\";s:8:\"cfgvalue\";s:5:\"false\";}i:9;a:2:{s:6:\"cfgk ey\";s:12:\"DISPLAY_CART\";s:8:\"cfgvalue\";s:4:\"true\";}i:10;a:2:{s:6:\"cfgkey \";s:32:\"ADVANCED_SEARCH_DEFAULT_OPERATOR\";s:8:\"cfgvalue\";s:3:\"and\";}i:11; a:2:{s:6:\"cfgkey\";s:18:\"STORE_NAME_ADDRESS\";s:8:\"cfgvalue\";s:31:\"Shop In, cache_entry_created = '1166808336']
    ------------------------------------------------------------

    Then I logged into my phpMyAdmin and there in the table zen_db_cache, there was already that key exits. Then I delete that record and my site was back.

    But today, I again find this same issue and looked at the zen_db_cache table. The same problem of duplication.
    Could anyone help me out what is causing this?

    Thanks

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Caching Error

    That scenario occurs when there is confusion between the session ID your browser is reporting vs what Zen Cart expects.

    I would suggest truncating your zen_db_cache table.
    Then clear your browser cookies and cache.


    In v1.3.6, as a security precaution, the error handler is written to not display all that detail if the error occurs due to some of the private data it could contain. It's probaby worth upgrading.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Aug 2004
    Location
    Saint Petersburg, Russia
    Posts
    1,786
    Plugin Contributions
    13

    Default Re: [Done v1.3.6] Caching Error db_cache table

    zen-cart 1.3.7
    1062 Duplicate entry 'zc_x.......................x' for key 1
    in:
    [db_cache table]
    The problem is not solved. On one of my shops this error occurs frequently.

  4. #4
    Join Date
    Aug 2004
    Location
    Saint Petersburg, Russia
    Posts
    1,786
    Plugin Contributions
    13

    Default Re: Caching Error

    Quote Originally Posted by DrByte View Post
    That scenario occurs when there is confusion between the session ID your browser is reporting vs what Zen Cart expects.
    It not so. Caching at all is not connected to sessions.

  5. #5
    Join Date
    Aug 2004
    Location
    Saint Petersburg, Russia
    Posts
    1,786
    Plugin Contributions
    13

    Default Re: [Done v1.3.6] Caching Error db_cache table

    I want to ask the developer team.

    Two parallel processes carry out identical quiry to a database.

    Process1 get sql_cache_exists(sql)==false
    Process2 get sql_cache_exists(sql)==false
    Process1 execute(sql)
    Process2 execute(sql)
    Process1 sql_cache_store(sql,result)
    Process2 sql_cache_store(sql,result) and got an error.

    There are three variants of the decision:

    1. Find
    Code:
      function sql_cache_store($zf_query, $zf_result_array) {
        global $db;
    Add below
    Code:
        if($this->sql_cache_exists($zf_query)) return true;
    2. Same as Nomber 1.
    Find
    Code:
          $sql = "insert into " . TABLE_DB_CACHE . " set cache_entry_name = '" . $zp_cache_name . "',
                                                     cache_data = '" . $result_serialize . "',
                       cache_entry_created = '" . time() . "'";
    Add above
    Code:
          $sql = "select * from " . TABLE_DB_CACHE . " where cache_entry_name = '" . $zp_cache_name . "' LIMIT 1";
          $zp_cache_exists = $db->Execute($sql);
          if ($zp_cache_exists->RecordCount() > 0) {
            return true;
          }
    3. Find
    Code:
          $sql = "insert into " . TABLE_DB_CACHE . " set cache_entry_name = '" . $zp_cache_name . "',
    Replace by
    Code:
          $sql = "REPLACE INTO " . TABLE_DB_CACHE . " set cache_entry_name = '" . $zp_cache_name . "',
    How you think, what way is better?

  6. #6
    Join Date
    Apr 2007
    Posts
    139
    Plugin Contributions
    0

    Default Re: [Done v1.3.6] Caching Error db_cache table

    Hi a_berezin

    Does this proven to eliminate the duplication in DB_Cache_table? I too have the same problem. Running the website in 2 parallel process.

    HELP! HELP!

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: [Done v1.3.6] Caching Error db_cache table

    Andrew's method #2 has been implemented in v1.3.8 (Thanks Andrew):


    /includes/classes/cache.php
    around line 118:
    Code:
          case 'database':
          $result_serialize = $db->prepare_input(serialize($zf_result_array));
          $sql = "insert into " . TABLE_DB_CACHE . " set cache_entry_name = '" . $zp_cache_name . "',
    	                                               cache_data = '" . $result_serialize . "',
    						       cache_entry_created = '" . time() . "'";
          $db->Execute($sql);
          return true;
          break;
    becomes:
    Code:
          case 'database':
          $sql = "select * from " . TABLE_DB_CACHE . " where cache_entry_name = '" . $zp_cache_name . "'";
          $zp_cache_exists = $db->Execute($sql);
          if ($zp_cache_exists->RecordCount() > 0) {
            return true;
          }
          $result_serialize = $db->prepare_input(serialize($zf_result_array));
          $sql = "insert into " . TABLE_DB_CACHE . " set cache_entry_name = '" . $zp_cache_name . "',
    	                                               cache_data = '" . $result_serialize . "',
    						       cache_entry_created = '" . time() . "'";
          $db->Execute($sql);
          return true;
          break;
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Apr 2007
    Posts
    139
    Plugin Contributions
    0

    Default Re: [Done v1.3.6] Caching Error db_cache table

    Great! Thanks alot.

  9. #9
    Join Date
    Apr 2007
    Posts
    139
    Plugin Contributions
    0

    Default Re: [Done v1.3.6] Caching Error db_cache table

    Hi Dr. Byte

    Actually i didnt want to tell you first since this already happened 4 days ago cause i just want to make sure. yeap...the caching error happened again. Yes it happens when i access and has someone else tested it for me at the same time. i sent you an attachment of the db cache table details. i dont know what else has gone wrong.
    Last edited by CJJUNE; 8 May 2007 at 02:15 PM.

 

 

Similar Threads

  1. Replies: 3
    Last Post: 21 Jan 2016, 10:35 PM
  2. Replies: 2
    Last Post: 14 Jan 2014, 07:42 PM
  3. Occasional error in db_cache table?
    By bi11i in forum General Questions
    Replies: 1
    Last Post: 13 Feb 2011, 09:53 AM
  4. 1146 Table 'XXXX.zen_configuration' doesn't exist in: [db_cache table]
    By CheapStairParts in forum General Questions
    Replies: 1
    Last Post: 4 Jan 2011, 12:39 AM
  5. Error: 1036 Table 'db_cache' is read only
    By namasa in forum General Questions
    Replies: 1
    Last Post: 26 Jul 2006, 07:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR