Even though this theme is disabled and the theme page wasn't being viewed I get this error. New error appears for every theme, disabled or enabled.

Location	admin/content/node2?order=changed&sort=desc - Views Bulk Operations Page
Referrer	admin/reports/dblog?page=2

Duplicate entry 'themes/pushbutton/pushbutton.info' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('pushbutton', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:10:\"Pushbutton\";s:11:\"description\";s:52:\"Tabled, multi-column theme in blue and orange tones.\";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/pushbutton/style.css\";}}s:7:\"scripts\";a:1:{s:9:\"script.js\";s:27:\"themes/pushbutton/script.js\";}s:10:\"screenshot\";s:32:\"themes/pushbutton/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'themes/pushbutton/pushbutton.info', 0, 0, 0) in /modules/system/system.module on line 821.

Don't know what triggers this error, it's not VBO.

Comments

skizzo’s picture

I am seeing the same error for all my themes (Garland variations)
see also http://drupal.org/node/367966

mikeytown2’s picture

Title: Duplicate entry error for every theme in theme dirs » Race Condition in system_theme_data() function. Duplicate entry error for every theme.
Version: 6.10 » 7.x-dev

Looks like this error is in the 7.x branch as well. Usual process is to fix it there then back port it.
http://api.drupal.org/api/function/system_theme_data

mikeytown2’s picture

Priority: Normal » Critical

http://api.drupal.org/api/function/db_lock_table would be a bad fix for 6.x; what about 7.x?

Should we set a semaphore?

berdir’s picture

Status: Active » Postponed (maintainer needs more info)

Can someone check if this still happens with latest D7? Those functions were changed and do now use the same logic to insert themes as modules do.

mikeytown2’s picture

Version: 7.x-dev » 6.x-dev
Status: Postponed (maintainer needs more info) » Active

Looking at the code in http://api.drupal.org/api/function/system_update_files_database/7 and it goes over each entry, updating them if they exist, killing if they don't; in 6.x it deleted first. The should not be a problem for 7.x.

Moving this back to a 6.x bug report.

crea’s picture

subscribing...

pimok3000’s picture

Version: 6.x-dev » 6.13

subscribing using Zen Subtheme

bcobin’s picture

subscribing - same problem using ATCK but is intermittent.

mikeytown2’s picture

jefkin’s picture

This problem persists though Drupal 6.19.

I found a solution, though it may not pass the mustard for all databases, it works for mine, and it means I'm not trying to explain how a damn error in drupal is not 'my problem' to my clients.

I'm still too busy to learn how to roll a patch but this is the code change:

Drupal 6.19:

file: modules/system/system.module original code line 822:

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);

My modification:

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

This version of the sql doesn't fail on duplicates, it just reinserts over-top (that's why it's replace instead of insert) -- which is fine for my purposes and maybe some of you will benefit too. I saw on another thread how the drupal community is worried about leaving postgres users behind.

My take on this is too bad for them, I've had to explain this one bug away for nearly 2 years now, and I simply no longer care, I just need a solution.

mikeytown2’s picture

@jefkin
Look into Pressflow; the MySQL only fork of Drupal.