Closed (duplicate)
Project:
Rules
Version:
7.x-2.x-dev
Component:
Rules Core
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jul 2013 at 06:42 UTC
Updated:
26 Dec 2015 at 08:01 UTC
Jump to comment: Most recent
Comments
Comment #1
fagoPlease try whether clearing your caches and/or running update.php helps.
Comment #2
noslokire commentedWe have been seeing this issue and have been working on finding the solution for the last month, flushing caches works but the issue comes back for us at a seemingly random point in time.
Our research has yielded that clearing the cache and cache_bootstrap tables works. We flushed each cache table individually, nothing fixed, but both together and everything works. Dont think this is actually a Rules issue per se, but the issue happens when trying to send an email after adding a new comment.
Comment #3
mikeytown2 commentedMight be related to #1903498: PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock;
Comment #4
das-peter commentedJust experienced this issue too. The weird thing is that
variable_set()usesdb_merge()which checks if the variable already exists in the table and dynamically choose insert / update.However, the check is done in php code and not via the native
INSERT ... ON DUPLICATE KEY UPDATEas provided by mysql (if you're using MySQL...).Which means there could be a timing issue if a lot of stuff is going on simultaneously.
Locking could be an issue of course, I'm not totally sure but I think innodb locking just affects the write statement in
db_merge()so the select to see if the variable exists will work right away, while the write may has to wait for another write transaction to be done. This means if the other write transaction was setting the same variable we're screwed because the return of the select statement isn't valid anymore after the lock is released.Comment #5
mikeytown2 commentedI've switched to READ COMMITTED and things are behaving a lot better.
#1650930: Use READ COMMITTED by default for MySQL transactions
Comment #6
das-peter commentedOh, I probably should mention that I use redis as cache backend. This issue could be an argument to use cache_get() / cache_set() instead variable_get() / variable_set(). The whole code was introduced by #1555634: Improve performance of event cache by moving to a whitelist - the question whether to use the caches or variables to store this was raised but not really answered.
However, this issue here seems to be, in my case, just a symptom of #2189645: Avoid full cache clear whenever a rules component or reaction rule is edited (Patches available).
Comment #7
anybodyConfirming this issue. We've just had the same... mysterious!
"PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'rules_event_whitelist' for key 'PRIMARY': ..."
Comment #8
Paul B commentedI get the same error in Rules 7.x-2.6. It seems to happen when orders are placed in Commerce while cron is running.
Comment #9
ibexy commentedhow did you solve the problem?
Comment #10
bdlangton commentedI concur with Paul B. I am using Rules 7.x-2.7 and get this error only when it's during a cron run.
Comment #11
joelpittetAlso getting a couple of these on cron run.
Comment #12
checker commentedI just want to add my error notice. Maybe it helps to find the problem...
Comment #13
nikita.izotov commentedPDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'private://retour.fr__0.pdf' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp, origname, type) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => retour.fr_.pdf [:db_insert_placeholder_2] => private://retour.fr__0.pdf [:db_insert_placeholder_3] => application/pdf [:db_insert_placeholder_4] => 77123 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1416385718 [:db_insert_placeholder_7] => retour.fr_.pdf [:db_insert_placeholder_8] => document ) in drupal_write_record() (line 7231 of /var/www/html/arendus/includes/common.inc).
Comment #14
nikita.izotov commentedCleaned cache and this gone
Comment #15
checker commentedAfter some investigation I find out this error happens more often than I thought. In my case every day and always in combination with drupal commerce.
For example at:
domain.com/checkout/xxx/shipping
domain.com/admin/commerce/orders/xxx/
domain.com/checkout/xxx/payment/return/xxxx
Error message is always the same (see above).
@nikita.izotov your error has nothing to do with this issue.
Comment #16
tedfordgif commentedThis was already fixed by #2190775: Misuse of variables table with rules_event_whitelist
Comment #17
aloknarwaria commentedI got the same issue when I push my database to live server. This issue occur because some inline item entries are not remove from other tables so i write sql statement to remove the unwanted entries. It work for me.
SQL Statement:
SELECT @maxcount := MAX(line_item_id) FROM commerce_line_item;
DELETE FROM `field_data_commerce_unit_price` WHERE entity_id > @maxcount;
DELETE FROM `field_revision_commerce_unit_price` WHERE entity_id > @maxcount;
DELETE FROM `field_data_commerce_total` WHERE entity_id > @maxcount;
DELETE FROM `field_revision_commerce_total` WHERE entity_id > @maxcount;
DELETE FROM `field_data_commerce_product` WHERE entity_id > @maxcount
DELETE FROM `field_revision_commerce_product` WHERE entity_id > @maxcount;
DELETE FROM `field_data_commerce_display_path` WHERE entity_id > @maxcount;
DELETE FROM `field_revision_commerce_display_path` WHERE entity_id > @maxcount;
DELETE FROM `field_data_field_line_item_audience` WHERE entity_id > @maxcount;
DELETE FROM `field_revision_field_line_item_audience` WHERE entity_id > @maxcount;
DELETE FROM `field_data_field_line_item_item_type` WHERE entity_id > @maxcount;
DELETE FROM `field_revision_field_line_item_item_type` WHERE entity_id > @maxcount;
Comment #18
sergey-shulipa commentedaloknarwaria , you've saved my day! Your post is extremely useful for me! Thanks a lot!