image_captcha path is generated by code:
$img_src = check_url(url("image_captcha/$captcha_sid/" . REQUEST_TIME));
For every generated captcha image, there will be executed menu_get_item() function, which will cache router item for every $img_src path;

 $cid = 'menu_item:' . hash('sha256', $path);
 cache_set($cid, $router_item, 'cache_menu');

Of course these menu_item cached records will never be reused. On high traffic pages cache_menu table grew over 800Mb.

Solution can be simple:
$img_src = check_url(url("image_captcha/$captcha_sid/", array( 'query' => array('ts' => REQUEST_TIME) )));

#1 1442746-fix_cache_menu_overflowing-1.patch1.57 KBMark Theunissen
PASSED: [[SimpleTest]]: [MySQL] 718 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Mark Theunissen’s picture

Priority: Minor » Normal
Status: Active » Needs review
Issue tags: +D7 stable release blocker
1.57 KB
PASSED: [[SimpleTest]]: [MySQL] 718 pass(es). View

Unfortunately, the captcha session id $captcha_sid also increments, so moving the timestamp out of the call is not enough. You'll need to move the $captcha_sid out, too.

Patch attached. I haven't tested on all browsers.

soxofaan’s picture

Status: Needs review » Closed (fixed)

slightly tweaked and committed:

sorry for the delay