Project:Chaos tool suite (ctools)
Version:6.x-1.6
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi,

im am observing a sporadic error in the ctools css cache table (see below). The error message occurs only for exactly one element. I understand that this is probably caused by a script being executed twice, and no locking in place. Or is this the result of a misconfiguration on the panels-UI?

FILE: modules/ctools/includes/css.inc on line 79.

ERROR: Duplicate entry 'rounded-corner:.rounded-corner' for key 'PRIMARY'

QUERY: INSERT INTO tableprefix_ctools_css_cache (cid, filename, css, filter) VALUES ('rounded-corner:.rounded-corner', ...

Comments

#1

I think you're probably right about the lack of locking causing this. Not quite sure how to fix this. We're not supposed to use lock tables, but...

#2

I have similar error message:

Duplicate entry 'rounded-corner:.rounded-corner' for key 1 query: INSERT INTO ctools_css_cache (cid, filename, css, filter) VALUES (&#
...
/sites/all/modules/ctools/includes/css.inc, line 79.

Have you managed to fix this somehow?

#3

Hey bloto,

I am not aware of fixing it or applying a patch, besides the usual updates, but the problem disappeared.

The only thing I see from my svn logs that I have altered and might be related, was a small perfomance thingie in panels. Please report in case it solves your problems.

(only applicable if you are using panels and have css aggregation enabled)

Index: panels/plugins/styles/corners/rounded_corners.inc
===================================================================
--- panels/plugins/styles/corners/rounded_corners.inc  (revision 848)
+++ panels/plugins/styles/corners/rounded_corners.inc  (revision 944)
@@ -132,7 +132,7 @@
     $filename = ctools_css_store($css_id, _panels_rounded_corners_css($idstr), FALSE);
   }

-  drupal_add_css($filename, 'module', 'all', FALSE);
+  drupal_add_css($filename, 'module', 'all', TRUE);
}

#4

Thank you,
I applied it yesterday, so far 1 event occured with this. So there must be something else that fix this.... I will keep observing..

#5

Status:active» postponed (maintainer needs more info)

The css cache system has been improved quite a bit since this bug was posted. Is anyone still getting this? I've never seen this happen in my testing.

#6

just got one:

Duplicate entry 'flexible:30' for key 'PRIMARY' query: ctools_css_store /* Anonymous : ctools_css_store */ INSERT INTO ctools_css_cache (cid, filename, css, filter) VALUES ('flexible:30', 'sites/xxxx.net/files/ctools/css/54c5fef89fa2a2908f95171c692ddafc.css', '.panels-flexible-column-30-main {\n float: left;\n width: 99.0000%;\n}\n\n.panel-flexible-30-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.panels-flexible-region-30-center {\n float: left;\n width: 99.0000%;\n}\n\n.panels-flexible-row-30-main-row-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.panels-flexible-column-30-3 {\n position: relative;\n float: left;\n background-color: transparent;\n width: 160px;\n}\n\n.panels-flexible-column-30-4 {\n float: left;\n width: 300px;\n}\n\n.panels-flexible-column-30-2 {\n float: left;\n width: 99.0000%;\n}\n\n.panels-flexible-row-30-1-left {\n margin-left: -160px;\n}\n\n* html .panels-flexible-row-30-1-left {\n left: 160px;\n}\n\n.panels-flexible-row-30-1-inside {\n padding-left: 160px;\n padding-right: 300px;\n}\n\n.panels-flexible-row-30-1-right {\n margin-right: -300px;\n}\n\n.panels-flexible-region-30-left {\n float: left;\n width: 99.0000%;\n}\n\n.panels-flexible-row-30-5-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.panels-flexible-region-30-main_ {\n float: left;\n width: 99.0000%;\n}\n\n.panels-flexible-row-30-6-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.panels-flexible-region-30-right {\n float: left;\n width: 99.0000%;\n}\n\n.panels-flexible-row-30-7-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n', 0) in /home/xxxx/public_html/drupal/sites/all/modules/ctools/includes/css.inc on line 79.

#7

Version:6.x-1.x-dev» 6.x-1.6
Priority:minor» normal

Hi

I don't know whether this is related or not but I got a similar warning message as:
User warning: Duplicate entry 'flexible:21' for key 1 query: INSERT INTO ctools_css_cache (cid, filename, css, filter) VALUES ('flexible:21', 'sites/default/files/ctools/css/b3805cc44f071d62d08fdbd3f92a991b_0.css', '.panels-flexible-column-21-main {\n float: left;\n width: 99.0000%;\n}\n\n.panel-flexible-21-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.panels-flexible-region-21-center {\n float: left;\n width: 99.0000%;\n}\n\n.panels-flexible-row-21-main-row-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.panels-flexible-column-21-2 {\n float: left;\n width: 32.6999%;\n}\n\n.panels-flexible-column-21-3 {\n float: left;\n width: 33.6161%;\n}\n\n.panels-flexible-column-21-4 {\n float: left;\n width: 32.6840%;\n}\n\n.panels-flexible-row-21-1-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.panels-flexible-region-21-column1 {\n float: left;\n width: 99.0000%;\n}\n\n.panels-flexible-row-21-5-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.panels-flexible-region-21-column2 {\n float: left;\n width: 99.0000%;\n}\n\n.panels-flexible-row-21-6-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.panels-flexible-region-21-column3 {\n float: left;\n width: 99.0000%;\n}\n\n.panels-flexible-row-21-7-inside {\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.panels-flexible-region-21-right {\n float: left;\n width: 253px;\n}\n\n.panels-flexible-region-21-bottom {\n float: left;\n width: 99.0000%;\n}\n\n.panels-flexible-row-21-8-inside {\n padding-left: 0px;\n padding-right: 253px;\n}\n\n.panels-flexible-row-21-8-right {\n margin-right: -253px;\n}\n\n', 0) in _db_query() (line 141 of /mnt/www/html/nasa/docroot/includes/database.mysqli.inc).

This happened when a user login and go to his/her account page.

Any glue on this.

Thanks
Truyenle

#8

Status:postponed (maintainer needs more info)» active

I got a similar message, like "Duplicate entry in ...".
Backtrace shows that error happens in ctools_css_store() function:

<?php
 
// Remove any previous records.
 
db_query("DELETE FROM {ctools_css_cache} WHERE cid = '%s'", $id);
 
// on high-loaded sites two or more users can reach this point at the same time
 
$filename = ctools_css_cache($css, $filter);
 
// and we have "duplicate entry..."
 
db_query("INSERT INTO {ctools_css_cache} (cid, filename, css, filter) VALUES ('%s', '%s', '%s', %d)", $id, $filename, $css, $filter);
?>

i think, we need to use some kind of lock (maybe lock_*() functions), or use INSERT IGNORE

#9

I am getting these errors regularly now.

user warning: Duplicate entry 'rounded-corner:.rounded-corner' for key 1 query: INSERT INTO ctools_css_cache (cid, filename, css, filter) ..............................

user warning: Duplicate entry 'flexiblev2:10' for key 1 query: INSERT INTO ctools_css_cache (cid, filename, css, filter) ..........................................

Has somebody found a solution? Thanks.

#10

Hi, I am getting similiar errors but I am running on the latest Drupal 7 version along with the following modules; Domain Access, Rules, Views, Display Suites, Date, Calendar, References, Organic Groups, CTOOLs, and Aquia Marena theme.

I get this error when i try to create new content of any type!!!

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'flexiblev2:8' for key 1: INSERT INTO {ctools_css_cache} (cid, filename, css, filter) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => flexiblev2:8 [:db_insert_placeholder_1] => public://ctools/css/bab59090150caf0c64e27afa1b36eef1.css [:db_insert_placeholder_2] => .panels-flexible-region { padding: 0; } .panels-flexible-region-inside { padding-right: 0.5em; padding-left: 0.5em; } .panels-flexible-region-inside-first { padding-left: 0; } .panels-flexible-region-inside-last { padding-right: 0; } .panels-flexible-column { padding: 0; } .panels-flexible-column-inside { padding-right: 0.5em; padding-left: 0.5em; } .panels-flexible-column-inside-first { padding-left: 0; } .panels-flexible-column-inside-last { padding-right: 0; } .panels-flexible-row { padding: 0 0 0.5em 0; margin: 0; } .panels-flexible-row-last { padding-bottom: 0; } .panels-flexible-column-8-main { float: left; width: 99.0000%; } .panels-flexible-8-inside { padding-right: 0px; } .panels-flexible-8 { width: auto; } .panels-flexible-region-8-center { float: left; width: 99.0000%; } .panels-flexible-row-8-main-row-inside { padding-right: 0px; } [:db_insert_placeholder_3] => 0 ) in ctools_css_store() (line 87 of /home/idev7615/public_html/sites/all/modules/ctools/includes/css.inc).