Duplicate entry errors - lots of them

Mercury500 - April 19, 2008 - 21:57
Project:Drupal
Version:6.x-dev
Component:menu system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

This is exactly the module I've been looking for - Thank you for creating it. The regex filter was difficult (and not ver 6) and this module is really great, lots of options to filter. But, I get about 60 duplicate entry errors when this module is active on my site every 20 minutes or so. I only created one filter - a text replacement filter and activated it in the Full HTML Input format. I also disabled the mediawiki filter.

Any ideas?

Thanks.

m

-------------------------------------------------
Drupal 6.2, latest Views, more status info below:
GD library bundled (2.0.34 compatible)
MySQL database 5.0.45
PHP 5.2.5
PHP memory limit 128M
PHP register globals Disabled
SimplePie Parser Installed correctly
The current installed version of SimplePie is 1.1.1
Unicode library PHP Mbstring Extension
Update notifications Enabled
Web server Apache/1.3.41 (Unix) mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7a
------------------------------------------------------------

This is the error(s)

Type php
Date Saturday, April 19, 2008 - 14:53
User Anonymous
Location http: // somedomain.com/public/node/490
Referrer
Message

Duplicate entry 'admin/build/views/%/remove-display/%' 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 ('admin/build/views/%/remove-display/%', 'a:2:{i:3;s:16:\"views_ui_js_load\";i:5;s:19:\"views_ui_cache_load\";}', '', 'user_access', 'a:1:{i:0;s:16:\"administer views\";}', 'views_ui_remove_display', 'a:2:{i:0;i:3;i:1;i:5;}', 58, 6, '', 'admin/build/views/%/remove-display/%', '', 't', '', 4, '', '', '', 0, 'sites/all/modules/views/includes/admin.inc') in /home/username32/public_html/somedomaincom/public/includes/menu.inc on line 2353.
Severity error
Hostname 66.249.66.230

#1

cwgordon7 - April 19, 2008 - 23:31
Project:Flexifilter» Views
Version:6.x-1.x-dev» 6.x-2.x-dev
Component:Code - Misc» Code
Category:support request» bug report

What makes you think this is for the flexifilter module? This is clearly fr the views module, as it refers to views menu entries being inserted into the {menu_router} table. Moved over to that issue queue.

#2

merlinofchaos - April 20, 2008 - 01:24
Project:Views» Drupal
Version:6.x-2.x-dev» 6.x-dev
Component:Code» menu system

Views doesn't insert data directly into menu_router, that's entirely handled by core. It shouldn't be possible for *any* module to create an error like this.

#3

Mercury500 - April 20, 2008 - 16:16

I'm pretty sure it's Flexifilter because the problem came when flexifilter was installed and goes away when flexifilter is disabled.

So, let's just say it IS Flexifilter and that it appears that it throws these errors when Views (in it's current state) is installed.

And since these Duplicate Entry Errors only happen when Flexifilter is enabled, I think it should be in the Flexifilter issues pile.

m

#4

cwgordon7 - April 20, 2008 - 22:12

Oh if you are on 6.x-dev as of a day ago in flexifilter, I accidentally left a menu_rebuild() in there, which would be why you are noticing it for the first time. However this still doesn't explain the error.

#5

Damien Tournoud - April 20, 2008 - 23:30

@cwgordon7: Hum. This looks like a race condition introduced by your call to menu_rebuild() on every init.

menu_rebuild() is not meant to be called at very page load. The DELETE call is far before the INSERT calls, which would explain why duplicate errors pop from time to time. I'm not sure what would be the implications of moving the DELETE call from menu_rebuild() to _menu_router_build(), just before the start of the insertions.

#6

cwgordon7 - April 21, 2008 - 07:31

Yes, I realize menu_rebuild is not supposed to be called on every page load. However, it should not be a problem, and I think this problem would still exist on menu_rebuild's, it's just the debug code I left in there that's making it visible.

#7

merlinofchaos - April 21, 2008 - 07:45

I agree. Actually, this hilites a very serious bug; on very busy sites, this race condition is bound to happen and anything that triggers a menu rebuild could cause ugliness.

I've already discussed with chx that the delete needs to be moved; but I think this means we also need to perform a LOCK TABLE prior to the delete and don't unlock until after the insert.

#8

Damien Tournoud - April 21, 2008 - 08:39
Status:active» needs review

Until Drupal does support transactions (and until transaction-aware MySQL installations are more common), there is no other way than to LOCK the whole table.

Here is a starter patch (only quickly tested).

AttachmentSizeStatusTest resultOperations
248739-race-conditions-menu-router.patch1.29 KBIgnoredNoneNone

#9

Richhh - April 21, 2008 - 20:40

I guess i got the same issue here, i dont know what happend, just discovered it this morning after a long night drupalling :|

When i select Home › Administer › Site building › Modules this error message pops up 4x:

user warning: Data too long for column 'load_functions' at row 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 ('gallery/%/%/%/%', 'a:4:{i:1;a:1:{s:12:\"gallery_load\";a:2:{i:0;s:4:\"%map\";i:1;s:6:\"%index\";}}i:2;a:1:{s:12:\"gallery_load\";a:2:{i:0;s:4:\"%map\";i:1;s:6:\"%index\";}}i:3;a:1:{s:12:\"gallery_load\";a:2:{i:0;s:4:\"%map\";i:1;s:6:\"%index\";}}i:4;a:1:{s:12:\"gallery_load\";a:2:{i:0;s:4:\"%map\";i:1;s:6:\"%index\";}}}', '', 'gallery_item_access', 'a:1:{i:0;i:4;}', 'gallery_menu_album', 'a:1:{i:0;i:4;}', 16, 5, '', 'gallery/%/%/%/%', '', 't', '', 4, '', '', '', 0, '') in C:\Inetpub\wwwroot\drupal\includes\menu.inc on line 2353.

Is the 248739-race-conditions-menu-router.patch the fix for me?

#10

pwolanin - April 22, 2008 - 01:04

it looks like this might be a duplicate of http://drupal.org/node/238760

#11

cwgordon7 - April 22, 2008 - 01:48

@pwolanin

it looks like this might be a duplicate of http://drupal.org/node/238760

Yeah, it is, I'll mark it as such.

@Richhh

Is the 248739-race-conditions-menu-router.patch the fix for me?

No.

#12

cwgordon7 - April 22, 2008 - 01:48
Status:needs review» duplicate

#13

chx - April 22, 2008 - 08:15
Status:duplicate» needs review

I am just wondering whether we can use a variable-based lock instead? If variable_set would tell us whether it updated or inserted then we can have something here. and currently variable_set has no return value... Just thinking aloud here.

#14

Damien Tournoud - April 22, 2008 - 08:20

@chx: what you will need is a semaphore. Drupal variables are not meant for that (they are cached, and thus asynchronous).

#15

chx - April 22, 2008 - 12:10

I was thinking on while (variable_set('rebuild_lock', TRUE) == VARIABLE_UPDATED) sleep(1); as a semaphore followed by a variable_del after the build. This need variable_set amed with VARIABLE_UPDATED/VARIABLE_INSERTED constants. The while loop probably needs an upper time limit (20 seconds?) when it goes ahead anyways.

#16

merlinofchaos - April 22, 2008 - 15:54
Status:needs review» active

variable_set used to perform a lock; does it still? And if it does, why not just use whatever system it uses to perform a lock? I'd be a little concerned about having an extra layer in there.

#17

pwolanin - April 22, 2008 - 17:24

can we move this (duplicate) discussion to the other issue? There is already a patch there to discuss.

#18

chx - April 23, 2008 - 04:08

variable_set does NOT perform a lock.

#19

catch - April 23, 2008 - 10:42
Status:active» duplicate

Back to duplicate. I've cross linked from the other issue. http://drupal.org/node/238760

#20

peter.swietoslawski - September 25, 2008 - 15:06

I've encountered the same issue as Richhh on post #9 while working on Views page /admin/build/views/edit/calendar_view_events.

My setup:
Drupal 6.4
PHP 5.2.6
MySQL 5.0.67

If you go to MySQL Query Browser Tools and check field load_function for menu_router table it shows this field is VARCHAR(255) while the data function is trying to put inside is a way longer (in my case 312 characters).
MySQL just complaints. I've changed datatype of this field to VARCHAR(360) and Drupal doesn't complain any longer.

Note:
While having the same site deployed on MySQL 4.1.22 I don't get the nasty error but on inspection of database it turned out that the load_function field is just truncated to 255 characters.

Of course I don't believe this is the right solution as it might break somewhere else.

Any ideas for proper solution?

#22

pipicom - August 29, 2009 - 20:29

hotblack's solution works for me!

(http://drupal.org/node/246653#comment-922486)

 
 

Drupal is a registered trademark of Dries Buytaert.