I've got 2 servers. One my local dev server, where clear cache/drush cc all works fine. The other, the "production" server I get this:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'FeedsCSVParser-class' for key 'PRIMARY'
The things that's odd about it is the way I built the production server is by dumping my dev database and restoring it on the server. I've updated a few places to deal with file system differences (e.g. media files), but otherwise everything seems to be working, except that I can't clear my cache. If I delete the feed importer, I can clear the cache. Obviously that's not ideal :)
I've seen other reports of similar errors. It's definitely some sort of bug, but I'm not sure that's it's a) related to Feeds specifically or b) not caused by my database dump/import.
Any pointers/suggestions appreciated.
Thanks.
Colin
Comment | File | Size | Author |
---|---|---|---|
#20 | feeds-ctools-registry-1347894-20.patch | 5.06 KB | twistor |
#5 | remove_plugins_from_feeds_info_1347894_0.patch | 933 bytes | juampynr |
Comments
Comment #1
colin_young CreditAttribution: colin_young commentedJust for fun, I tried to clone the importer and delete the problem one, but that didn't help. It seems that just having an importer causes the problem.
Comment #2
pameeela CreditAttribution: pameeela commentedI'm having the same problem but with profile2. Locally cc all works fine but on the production server it's throwing:
WD profile2_type: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'main_clone' for key 2: INSERT [error]
INTO {profile_type} (type, label, weight, data, status, module) 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); Array
Several other similar issues mention duplicate include files but I can't find any more detail on this.
Comment #3
colin_young CreditAttribution: colin_young commentedIt seems that it's definitely a result of moving the files from server to server. Truncating the cache table cleared it up for me (oddly, I excluded that from backup_migrate, but it was still giving me trouble). Thanks to #1324000: Failed to rebuild registry on PDO Exception: duplicate entry for cluing me in.
Comment #4
pameeela CreditAttribution: pameeela commentedWe solved our problem by upgrading to the stable version of profile2, but it only worked if the change was done before the cache was cleared for the first time - i.e. a fresh install without the dev version of profile2.
Clearing cache with the dev version of profile2 breaks something, and the
PDOException: SQLSTATE23000: Integrity constraint violation: 1062 Duplicate entry 'main_clone'
is present regardless what upgrades are performed.
Possibly truncating the cache table would have worked too but in the meantime we got around it.
Comment #5
juampynr CreditAttribution: juampynr commentedThis happens because Feed's plugins are being loaded twice (first at feeds.info and then by Ctools).
There is no need in having the list of plugins included in the feeds.info file. Attached is a patch that fixes the issue.
Comment #6
juampynr CreditAttribution: juampynr commentedChanging status.
Comment #7
emackn CreditAttribution: emackn commentedAre there steps to reproduce this error?
Comment #8
juampynr CreditAttribution: juampynr commentedSure, here you are:
I wonder if it is because of the line:
That collides with the lines at feeds.info where it is already including all plugins. The patch I provided above fixes the issue so that proves that there is an attempt to double load plugins while recreating the registry.
Comment #9
emackn CreditAttribution: emackn commentedclearing cache via drush?
The only step i dont do is move the code to a different physical server. I move it to a different database and vhost, but fail to get the error you are talking about. I don't doubt that it is happening, just need to find a reliable way to reproduce the error.
Comment #10
juampynr CreditAttribution: juampynr commentedYes.
It may seem hard to recreate but it is a common scenario when you copy a dev environment to your local box.
Comment #11
twistor CreditAttribution: twistor commented@juampy Having the class files in the .info file doesn't mean that they are included. It means that they can be automatically loaded if the class isn't available. The error you're describing would occur regardless of a migration.
Comment #12
juampynr CreditAttribution: juampynr commented@twistor, I just could reproduce it consistently with the steps given at #8.
How could then removing the files from feeds.info fix the error?
Comment #13
emackn CreditAttribution: emackn commentedIm beginning to think these are separate issues. One being the PDO error (which looks fixed), and the other being the unnecessary inclusion of plugins in the feeds info file. I'm going to commit the info file change and close this issue.
Comment #14
emackn CreditAttribution: emackn commentedcommitted at d350c4515cd31dc93cdc42f18e532f4ba1f2ed9f
Comment #15
colin_young CreditAttribution: colin_young commentedFWIW and as the original reporter, I think you're right about there being 2 issues here.
I'm not entirely convinced that moving the cache data from one site to another is the right thing to do. It does sound like you've found a legitimate unrelated problem as a result of my report though.
Comment #16
juampynr CreditAttribution: juampynr commentedI have found that this same error has been reported in issues form other projects. However there is no clear answer to what the problem exactly is.
#1324000: Failed to rebuild registry on PDO Exception: duplicate entry
#1265564: PDOException due to class auto-loading registry when running a cache clear
Comment #17
twistor CreditAttribution: twistor commentedRemoving the classes from the .info is the wrong decision.
There was already an issue to add them in the first place. #1201638: Plugins should be listed in info file.
One thing that should be tried is removing the file and path arguments from feeds.plugins.inc. I know for a fact that this works, but I don't know if it will fix the bug as I can't reproduce it.
@#15, It's the registry that's the tricky part since it stores the actual filename of each class.
How can this be committed on a hunch? There hasn't been a logical reason as to why this approach works, and if it does prove to work, it's still the exact wrong approach and something else needs to be fixed.
Comment #18
juampynr CreditAttribution: juampynr commentedHere are updated steps to reproduce the problem consistently:
I am debugging includes/registry.inc to see why the file is being loaded twice.
Comment #19
juampynr CreditAttribution: juampynr commentedI debugged the Ctools plugin system and found an issue with it. I have created an issue in the Ctools issue queue with a patch that fixes this error (#1371700: CTools adds cached plugins with wrong paths during hook_registry_files_alter() in multisite systems). I need someone to verify that the patch given there fixes the issue. If it does, then it is safe to add the plugins again to feeds.info.
Comment #20
twistor CreditAttribution: twistor commentedI've been meaning to submit this anyway, but this patch adds the classes back to the .info file and removes the path and file arguments from feeds.plugins.inc.
I've verified that nothing explodes. Can someone test to see if it solves the issue?
Comment #21
abeger CreditAttribution: abeger commentedThere seems to be some work on the root problem here: #1372122: STOP the registry integrity constraint violation nightmare
Comment #22
Matthew Davidson CreditAttribution: Matthew Davidson commentedI've tried twistor's patch - the feeds.plugin.inc bit of it at least; the .info file bit is redundant if you didn't apply the earlier patch - and I can now flush the cache with no side effects I've been able to detect. However the same issue affects the (broken anyway) D7 port of iCal feed parser and goodness knows how many other modules, so it's good to see the problem getting some attention in core, where it needs to be addressed. I think this should be considered a temporary workaround.
Comment #23
juampynr CreditAttribution: juampynr commentedThe issue has been explained at http://drupal.org/node/1372122#comment-5392170. There is a suggested core patch that fixes all these issues by doing a db_merge() instead of a db_insert().
Hopefully we can get this moving and solve a set of reported issues.
Comment #24
emackn CreditAttribution: emackn commentedawaiting outcome of core patch
Comment #26
joseph_leon CreditAttribution: joseph_leon commentedI had the same problem as you guys but I fixed it by turning off the feed modules, clearing cache in the drupal admin (not drush), running cron, then turning back on the modules. After that everything worked fine.
Comment #27
juampynr CreditAttribution: juampynr commentedDrupal 7.14 includes a fix for this.
http://drupal.org/node/1558424
Comment #29
scripthead CreditAttribution: scripthead commentedStill happening on 7.32.