Hi all please help,

In my log i am getting hundreds maybe even thousands of duplicate entry errors I will paste a few of them they are all related to the theme engine. I am running a custom theme called redwood. all other default themes are not enabled.

Duplicate entry 'themes/engines/theme_editor/theme_editor_engine.engine' for key 1 query: INSERT INTO system (name, type, filename, status, throttle, bootstrap) VALUES ('theme_editor_engine', 'theme_engine', 'themes/engines/theme_editor/theme_editor_engine.engine', 1, 0, 0) in /usr/local/drupal/drupal/includes/database.mysql.inc on line 121.
Duplicate entry 'themes/bluemarine/page.tpl.php' for key 1 query: INSERT INTO system (name, description, type, filename, status, throttle, bootstrap) VALUES ('bluemarine', 'themes/engines/phptemplate/phptemplate.engine', 'theme', 'themes/bluemarine/page.tpl.php', 0, 0, 0) in /usr/local/drupal/drupal/includes/database.mysql.inc on line 121.
	Duplicate entry 'themes/chameleon/marvin/style.css' for key 1 query: INSERT INTO system (name, description, type, filename, status, throttle, bootstrap) VALUES ('marvin', 'themes/chameleon/chameleon.theme', 'theme', 'themes/chameleon/marvin/style.css', 0, 0, 0) in /usr/local/drupal/drupal/includes/database.mysql.inc on line 121.
Duplicate entry 'themes/chameleon/marvin/style.css' for key 1 query: INSERT INTO system (name, description, type, filename, status, throttle, bootstrap) VALUES ('marvin', 'themes/chameleon/chameleon.theme', 'theme', 'themes/chameleon/marvin/style.css', 0, 0, 0) in /usr/local/drupal/drupal/includes/database.mysql.inc on line 121.

Please help,

Paul

Comments

DrupalIsWet’s picture

I was having the same problem in 6.2 and could not find a solution in the posts. Today, I went to Admin / Site building / Themes and noticed that my default theme was no longer selected as enabled. Weired or bug? Got me. So far, so good with it re-enabled.

parrottvision’s picture

yeah - i just updated to drupal 6.12 and had the errors. Went to themes page and my Zen theme was default but not enabled. So far so good now...

designanddraft’s picture

i have been having a similar list of multiple duplicate entries, nothing about them suggested the theme though. i found a differance between my global and theme specific settings and changed them to match. this seems to have solved it, however i ran cron, changed them back and ran cron in order to recreate the issue and nothing, the errors are not back so i think it is strange. my errors listed line 2353 of menu.inc and i use zen classic theme on drupal 6.2. i will write back if it happens again.

designanddraft’s picture

here is a copy of errors, a small portion anyway. now it seems to appear on the first page after i make a change to something, taxonomy, menu, etc. and then not again until another change, this is tolerable but seems to be a bug none the less. before now it was on every page.

user warning: Duplicate entry 'comment_subscribe' for key 1 query: INSERT INTO menu_router (path, load_functions, to_arg_functions, access_callback, access_arguments, page_callback, page_arguments, fit, number_parts, tab_parent, tab_root, title, title_callback, title_arguments, type, block_callback, description, position, weight, file) VALUES ('comment_subscribe', '', '', 'user_access', 'a:1:{i:0;i:1;}', 'comment_subscribe_page', 'a:0:{}', 1, 1, '', 'comment_subscribe', 'Comment Subscribe', 't', '', 4, '', '', '', 0, '') in /home/content/d/e/s/designanddraft/html/govbyus/includes/menu.inc on line 2353.
user warning: Duplicate entry 'wiki' for key 1 query: INSERT INTO menu_router (path, load_functions, to_arg_functions, access_callback, access_arguments, page_callback, page_arguments, fit, number_parts, tab_parent, tab_root, title, title_callback, title_arguments, type, block_callback, description, position, weight, file) VALUES ('wiki', '', '', 'user_access', 'a:1:{i:0;s:14:\"access content\";}', 'wikitools_handle_request', 'a:0:{}', 1, 1, '', 'wiki', '', 't', '', 4, '', '', '', 0, '') in /home/content/d/e/s/designanddraft/html/govbyus/includes/menu.inc on line 2353.
user warning: Duplicate entry 'node' for key 1 query: INSERT INTO menu_router (path, load_functions, to_arg_functions, access_callback, access_arguments, page_callback, page_arguments, fit, number_parts, tab_parent, tab_root, title, title_callback, title_arguments, type, block_callback, description, position, weight, file) VALUES ('node', '', '', 'user_access', 'a:1:{i:0;s:14:\"access content\";}', 'node_page_default', 'a:0:{}', 1, 1, '', 'node', 'Content', 't', '', 4, '', '', '', 0, '') in /home/content/d/e/s/designanddraft/html/govbyus/includes/menu.inc on line 2353.
user warning: Duplicate entry 'image_attach' for key 1 query: INSERT INTO menu_router (path, load_functions, to_arg_functions, access_callback, access_arguments, page_callback, page_arguments, fit, number_parts, tab_parent, tab_root, title, title_callback, title_arguments, type, block_callback, description, position, weight, file) VALUES ('image_attach', '', '', 'user_access', 'a:1:{i:0;s:14:\"access content\";}', 'image_attach_view_image', 'a:0:{}', 1, 1, '', 'image_attach', 'Image Attachment View', 't', '', 4, '', '', '', 0, '') in /home/content/d/e/s/designanddraft/html/govbyus/includes/menu.inc on line 2353.

dewolfe001’s picture

Hi Paul,
We are plagued by this as well. I think the root cause is heavy traffic and database table locking. What happens:
Request #1 spawn this theme assessment build-- loads the directory tree into the application's memory (the bigger the tree, the longer the load).
Request #2 does the same unaware that the re-build in underway
Request #1 adds a record (INSERT)
Request #2 tries the same because it has the directory and that list is LARGE (we have34+ themes and dozens of files so directory traversal is a minefield).
Request #2 spawns an exception that causes a bump in the road.
(Requests #3-#50 are in the same boat as #2).

My workaround is a modification to system.module (ca. line 983):

db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d) ON DUPLICATE KEY UPDATE filename='%s'", $theme->name, $theme->owner, 'theme', $theme->filename, $theme->status, 0, 0, $engine->filename);

This does rely on MySQL 5 and the existence of the ON DUPLICATE KEY functionality. So, it will blow database engine neutrality but at least the site will stay up.

All the best,

Mike

cgdigitaltreats’s picture

I get this problem on two different installs of drupal 6.

Antnio

billnbell’s picture

// db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0, 0);
db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d) ON DUPLICATE KEY UPDATE filename='%s'", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0, 0, $theme->filename);

In file system.module

billnbell’s picture

Should this fix be put into the core Drupal 6.10? It is dependent on Mysql 5 is the only issue.

function: function system_theme_data()

The command: db_query("DELETE FROM {system} WHERE type = 'theme'") does not appear to work. Since the insert happens and the info is still in there. One solution may be to put these into an atomic operation (transaction) which is only in InnoDB...

The problem seems to happen with long running cron.php and users are updating stuff on the site.

The bigger question: Why are we deleting and inserting so often to begin with?

Bill

billnbell’s picture

Maybe there should be a db_lock between the 2 statements?

RobertOak’s picture

So far, the PHP log is showing no more duplicates. but where is this coming from? I had skinr module installed at one point but uninstalled it. This is an updated site from 5.22. In my Drupal 6.16 in system.module it is line 822.

Drupal_is_amazing’s picture

Intermittently get warnings of the following form.

user warning: Duplicate entry 'themes/bluemarine/bluemarine.info' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('bluemarine', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:10:\"Bluemarine\";s:11:\"description\";s:66:\"Table-based multi-column theme with a marine and ash color scheme.\";s:7:\"version\";s:4:\"6.10\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:7:\"project\";s:6:\"drupal\";s:9:\"datestamp\";s:10:\"1235596218\";s:7:\"regions\";a:5:{s:4:\"left\";s:12:\"Left sidebar\";s:5:\"right\";s:13:\"Right sidebar\";s:7:\"content\";s:7:\"Content\";s:6:\"header\";s:6:\"Header\";s:6:\"footer\";s:6:\"Footer\";}s:8:\"features\";a:10:{i:0;s:20:\"comment_user_picture\";i:1;s:7:\"favicon\";i:2;s:7:\"mission\";i:3;s:4:\"logo\";i:4;s:4:\"name\";i:5;s:17:\"node_user_picture\";i:6;s:6:\"search\";i:7;s:6:\"slogan\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:11:\"stylesheets\";a:1:{s:3:\"all\";a:1:{s:9:\"style.css\";s:27:\"themes/bluemarine/style.css\";}}s:7:\"scripts\";a:1:{s:9:\"script.js\";s:27:\"themes/bluemarine/script.js\";}s:10:\"screenshot\";s:32:\"themes/bluemarine/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'themes/bluemarine/bluemarine.info', 0, 0, 0) in /f1/content/extratoxictreat/public/d/modules/system/system.module on line 821.

When they happen, I get many at one time, all of this same form-- one warning per theme.

mennonot’s picture

I'm was getting the Duplicate entry... for key 1 error on every page of my site for each theme. As suggested a couple times in this thread, I ran cron.php again and the problem seems to have gone away.

Slovak’s picture

Got the same issue in Drupal 6.12. Usually get 5-10 of these theme errors at a time. Most of them appear to come at/around midnight.

billnbell’s picture

Does it happen when cron.php runs?

Slovak’s picture

Manually running example.com/cron.php fixed it for me. Had the issue on several installs - all of them went away.

osopolar’s picture

I think here are two different errors mixed. The original (from Paul_83uk - August 21, 2007 - 05:31) says "... keeps crashing the server ...".
The error occurs in /usr/local/drupal/drupal/includes/database.mysql.inc on line 121.

The later error messages/warnings are related to includes/menu.inc and to modules/system/system.module.

Thats why I think you should google a bit more for your error and post to the other issues around here.

For the system.module issue (on line 821.) you may post to this issue: #477550: "User warning: Duplicate entry ... " ... Themes

Other posts:
http://drupal.org/node/367966
http://drupal.org/node/251693

ViewOracle’s picture

Just had this problem.
1) Using Drupal 6.12 with theme Acquia Marina.
2) Had a status of required updating.
3) Acquia Marina and all core themes came up with the duplicate error message
4) Dowloaded the latest version of Acquia Marina and installed
5) All error messages have gone away and web site running wonderfully

Appears to be a MySQL error with the warning that a latest version needs to be downloaded.

derp’s picture

cron.php fixed it for me.

Alan.Guggenheim’s picture

It is happening several times a day now and for a lot of users. This is becoming critical.

Saoirse1916’s picture

Same here -- I've got a site that's in offline mode (still under development) and it still happens frequently for me.

Jerome F’s picture

Same issue in drupal 6.15
Subscribing

I maybe should mark this as duplicate :
See #147000: Rewrite module_rebuild_cache() and system_theme_data() and #307756: Backport of #147000: Unify and rewrite module_rebuild_cache() and system_theme_data()
But this is still not fixed in drupal 6 as far as I understand this.

Desi Raaj’s picture

I had the same problem, none of the above methods work so i did the following in the system.module on line 822, i'm not sure how it will affect the site but it got rid of the problem, mine was caused by flushing cache--> using some sort of ajax query (in my case uc_out_of_stock module) and then redirecting to any page on my site showed the error, can anyone tell me how the following change will affect the site?

Changed:
db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0, 0);
}

To
db_query("REPLACE INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0, 0);
}

dhakshinait’s picture

i am using drupal 6.22.can anyone help us to remove this error?

jnettik’s picture

I'm using 6.22 and I'm seeing the same error.

altavis’s picture

Hi

Try to run update.php, but first you need to set $update_free_access to TRUE in your settings.php file.