After activating Adim I get (for anonymous user)
Fatal error: Maximum execution time of 30 seconds exceeded in /home/www/newvtad/includes/database/query.inc on line 1340
No problem when I am logged in as an administrator.
Problem disappears after deactivation of the module admin.
Only user 1 has permission for this module

Comments

Sergey Naumov’s picture

I can confirm this behaviour.

himerus’s picture

Title: Timeout if not logged in » infinite loop occurring for everyone but user1
Priority: Major » Critical

This is happening not just for anon users, but also auth users.

The best I've found so far is that is likely occurring in the access callback admin_landing_page_access in admin.module.

I will continue to investigate, and if I can supply a patch once I can find the location of the error.
Whatever has caused this issue is a change between alpha6 of Drupal 7, and the current beta1.

I'm not having this issue on my blog, which is still running alpha6, and I've been running into this when attempting my upgrade path/migration to beta1.

The ONLY account that does not have issue currently is user1 in my tests.

himerus’s picture

I've definitely isolated the issue to the admin_landing_page_access() function.

I've commented out admin_menu_alter, which is setting admin_landing_page_access as the access callback. After clearing menu cache, the issue is resolved... So the error either lies in the menu_alter hook, or in the access callback.

Will update again as I have a solution to patch this.

function admin_menu_alter(&$items) {
  foreach ($items as $path => $item) {
    // Smarter access callback for poorly checked landing pages
    if (!empty($item['access arguments']) && !empty($item['page callback']) && $item['access arguments'] === array('access administration pages') && in_array($item['page callback'], array('system_admin_menu_block_page', 'system_settings_overview'))) {
      $items[$path]['access callback'] = 'admin_landing_page_access';
      $items[$path]['access arguments'] = array($path);
    }
  }
}
himerus’s picture

Assigned: Unassigned » himerus
Status: Active » Needs review
StatusFileSize
new1.06 KB

Patch attached that solves the problem in my environment. Not sure if it adversely affects the actual functionality behind admin_landing_page_access.

function admin_landing_page_access($path) {
  static $paths;
  if (!isset($paths[$path])) {
    $paths[$path] = FALSE;

    // Retrieve menu item but without menu_get_item()
    $item = db_select('menu_links')
      ->fields('menu_links', array('mlid', 'menu_name'))
      ->condition('module', 'system')
      ->condition('router_path', $path)
      ->execute()
      ->fetchAssoc();
    if ($item) {
      $query = db_select('menu_links', 'ml');
      $query->leftJoin('menu_router', 'm', 'm.path = ml.router_path');
      $query->fields('ml');
      $query->fields('m', array_diff(drupal_schema_fields_sql('menu_router'), array('weight')));
      $query->condition('ml.plid', $item['mlid']);
      $items = $query->execute()->fetchAssoc();
      if ($items) {
        foreach ($items as $item) {
          _menu_link_translate($item);
          if ($item['access']) {
            $paths[$path] = TRUE;
            break;
          }
        }
      }
    }
  }
  return $paths[$path];
}

If anyone can verify that this does in fact solve the issue without affecting functionality, that would be great!

alex_b’s picture

Assigned: himerus » Unassigned
StatusFileSize
new1.17 KB

#4 just fixes the symptom, the access handler actually has to decend into a path's children to determine access to a path. This patch fixes the described problems.

yhahn’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.