Running 7.0 with all modules current.

Only search found is #597236 which recently is mostly about performance not a bug.

I got this error on a page on a shared server where I suspect that nothing was paged in as it was taking a long time for the home page to come up. I am basically the only one who knows about the site. I then clicked on a link on the home page and got the error. Refresh fixed the problem. So something about the problem is timing dependent. I am logged on as user=1 so there is probably very little caching available.

Nothing in the watchdog log. Probably not repeatable.

Comments

cpforbes’s picture

I ran into the same problem it seemed to be a corrupt cache of some sort. The entity.inc file was not being loaded.

Truncating the cache tables by hand did not change the behavior.

I could not run drush or connect to the site. Eventually I seeded the lookup_cache entry in the cache_bootstrap table with an entry from a different Drupal install.

I have no idea what the root cause was.

topdawg’s picture

What if I don't have another install, do I need to do a full restore from a couple of days ago?

adamdicarlo’s picture

One cause of this type of error is modules being moved to new locations.

I had moved a module, then Drupal wouldn't bootstrap, so I manually fixed the system table's "filename" entries (D6 thinking) -- to no avail, because the code registry was still invalid. So I cleared the registry and registry_file tables, thinking they'd get rebuilt automatically. WHOOPS -- they don't.

What I did to fix it was piece together this script (run it from within your Drupal 7 root directory):

#!/usr/bin/env php
<?php
// $Id$

/**
 * @file
 * Rescue script that rebuilds the code registry in the event of Drupal not
 * being able to do a full bootstrap due to a corrupt/lost code registry.
 * One cause of a bad registry is modules being moved to a new location.
 *
 * Run from the root directory of the Drupal installation.
 */

/**
 * Root directory of Drupal installation.
 */
define('DRUPAL_ROOT', getcwd());

$_SERVER['HTTP_HOST']       = 'default';
$_SERVER['PHP_SELF']        = '/index.php';
$_SERVER['REMOTE_ADDR']     = '127.0.0.1';
$_SERVER['SERVER_SOFTWARE'] = NULL;
$_SERVER['REQUEST_METHOD']  = 'GET';
$_SERVER['QUERY_STRING']    = '';
$_SERVER['PHP_SELF']        = $_SERVER['REQUEST_URI'] = '/';
$_SERVER['HTTP_USER_AGENT'] = 'console';

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/modules/system/system.module';
drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);

registry_rebuild();

The error I'd gotten was slightly different: Error: Class 'DrupalDefaultEntityController' not found in
/path/to/drupal/modules/user/user.module, line 281

Not sure if this would've completely worked if I hadn't already fixed the system table entries manually.

If you're on Windows, look at the comment near the top of /scripts/drupal.sh for basic instructions on getting a shell script to run. (I haven't tried this on Windows.)

misscosmic’s picture

i'am having the same error... although that is what I think. I hardly know anything about PHP. My error log says:

[19-Feb-2011 16:16:25] PHP Fatal error:  Allowed memory size of 8388608 bytes exhausted (tried to allocate 287139 bytes) in /Applications/MAMP/htdocs/drupal/includes/registry.inc on line 144
[19-Feb-2011 16:17:18] PHP Fatal error:  Class 'DrupalDefaultEntityController' not found in /Applications/MAMP/htdocs/drupal/modules/user/user.module on line 281

I get a blank page http://localhost:8888/... Do you think you can help me..?

bfroehle’s picture

Category: bug » support

@misscosmic: Drupal 7 requires at least 32mb of memory -- see System Requirements: PHP and Increase PHP memory limit.

jhedstrom’s picture

@adamdicarlo, you should consider merging that script with Registry Rebuild (a drush command) if there are parts that aren't already in there.

mattwmc’s picture

I get the following error when trying to run the script:

Parse error: syntax error, unexpected T_STRING in /home/content/xxxx on line 20

Line 20:

$_SERVER['HTTP_HOST']       = 'default';
Anonymous’s picture

while update my core from 7.10 to 7.12, I got this error too, occurring in

user.module, line 296, :

I tried the above script but didn't help... then I found another similar script at http://drupal.org/node/1253402. after some editing , it fixed my the problem! Thank!

Here is the rescue script I used:

// $Id$

/**
* @file
* Rescue script that rebuilds the code registry in the event of Drupal not
* being able to do a full bootstrap due to a corrupt/lost code registry.
* One cause of a bad registry is modules being moved to a new location.
*
* Run from the root directory of the Drupal installation.
*/

/**
* Root directory of Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());

$defaults = array(
'HTTP_HOST' => 'localhost',
'PHP_SELF' => '/index.php',
'QUERY_STRING' => '',
'REQUEST_URI' => '/',
'SCRIPT_NAME' => NULL,
'REMOTE_ADDR' => '127.0.0.1',
'REQUEST_METHOD' => 'GET',
'SERVER_NAME' => NULL,
'SERVER_SOFTWARE' => NULL,
'HTTP_USER_AGENT' => 'console',
);
// Replace elements of the $_SERVER array, as appropriate.
$_SERVER = $_SERVER + $defaults;
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/entity.inc';
require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/modules/system/system.module';
require_once DRUPAL_ROOT . '/includes/database/select.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);


registry_rebuild();
mitchell’s picture

Title: Fatal error: Class 'DrupalDefaultEntityController' not found in comment.module on line » Registry can get hopelessly hosed
Component: comment.module » base system
Category: support » bug
Priority: Normal » Major
Issue tags: +Needs issue summary update, +DrupalWTF

This error seems to occur from many sources during the update process, see #1190842: 7.x-2.0-beta2 (and 2.1) breaks EntityAPI for another example. Much like #3 and #8, Registry Rebuild is a project dedicated to providing a rescue script in the event of registry crashes.

If it's possible to check the registry for this problem and perform a registry_rebuild() during the update process, then that would solve this problem in later Drupal versions. Even if it's not possible to do it automatically, update.php could provide this function to site maintainers who need to run it manually.

catch’s picture

mikeytown2’s picture

I had to add this in to #8

require_once DRUPAL_ROOT . '/includes/database/database.inc';
require_once DRUPAL_ROOT . '/includes/database/query.inc';