I experienced my website crashing apache today after activating the Skinr module. I have the APC cache enabled for caching my php pages. I got errors "Cannot redeclare class" errors for several database-related classes.

My guess is that somewhere in Skinr, include files containing class declarations are included without checking whether they have already been declared before. Using include_once may fix the problem. I could not find the critical piece of code, but removing the Skinr module fixed my site.

Sorry for not being able to provide more info on the issue, I hope it helps to track down a problem that may hit any productive site with APC enabled.

Cheers, Lars.

Comments

moonray’s picture

Status: Active » Postponed (maintainer needs more info)

Could you please list the classes you refer to?
I'm not aware of any classes defined for Skinr. Are you sure this isn't due to some other module?

For reference, any files included use include_once already.

grobe’s picture

Hi Moonray,

I had already added some wrappers to prevent redeclarations, but one would look like that:

PHP Fatal error: Cannot redeclare class DatabaseSchemaObjectExistsException in /var/www/drupal/drupal-7.10/includes/database/schema.inc on line 708, referer: http://www.xxx.net/user

I am not sure whether this happens only when logged in as an admin (enabling the admin overlay) or not, but removing the Skinr-module definitely solves the problem on my site.

I am running Drupal on a Postgres-backend.

Cheers, Lars.

paulmicha’s picture

I just had the same issue, using APC and Postgres, but NOT using the Skinr module (this issue is the only relevant match in Google for this error) - Apache logs said :

[Wed Mar  6 10:13:56 2013] [apc-error] Cannot redeclare class databaseschemaobjectexistsexception in /xyz/includes/database/database.inc on line 1745.
[Wed Mar  6 10:12:28 2013] [apc-warning] GC cache entry '/xyz/sites/all/modules/custom/some/custom/module/file.inc' (dev=2049 ino=771031) was on gc-list for 58306 seconds in /xyz/includes/bootstrap.inc on line 3066.

In my case, I had declared a menu callback like :

$items[ 'node/%node/customtab' ] = array(
    'title' => t( "Action custom" ),
    'page callback' => 'my_custom_tab_page_callback',
    'page arguments' => array( 1 ),
    'access callback' => 'node_access',
    'access arguments' => array( 'update', 1 ),
    'weight' => 2,
    'type' => MENU_LOCAL_TASK,
    
    //    This was the culprit :
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    
    'file' => 'tab_page.inc',
);

I copy / pasted the core node module's edit tab menu declaration, but I had left the 'context' key - not knowing exactly what it did : it turns out when I removed this 'context' key from the menu callback, the fatal error was gone.

I don't know if it can help, but I thought I'd mention it just in case (I'm not sure where this analysis belongs either).

moonray’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Can't replicate and seems there are other more probable causes. Closing.