Mahara breaks when apc.stat is set to 0

Bug #548333 reported by Jai Gupta
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
François Marier

Bug Description

Mahara break when APC is on and apc.stat is turned off.

This can be tested by trying to delete a view.

This bug was imported from eduforge.org, see:
https://eduforge.org/tracker/index.php?func=detail&aid=3420&group_id=176&atid=739

Revision history for this message
Nigel-catalyst (nigel-catalyst) wrote :

Hi - can you please provide some more information about this? Like what error you're seeing, and whether clearing your APC cache fixes the problem?

apc.stat is a setting that shouldn't really affect any scripts at all - it just means the php scripts aren't statted to find out whether they've changed. If you somehow got a dodgy PHP file into the cache, then you'll have to clear it of course.

Revision history for this message
Jai Gupta (jai-keytoschool) wrote :

Hi Nigel,

Clearing cache does not help. Error I get is.

=================
[apc-error] Cannot redeclare class maharathrowable in /mahara/init.php on line 47.
=================

I also tried adding file init.php in APC filter so it does not cache. Then I get following errors.

=================
[Thu Oct 29 02:36:30 2009] [error] [client xx.xx.xx.xx] [WAR] 53 (view/view.php:27) Constant INTERNAL already defined, referer: http://example.com/mahara/view/blocks.php?new=1&id=6
[Thu Oct 29 02:36:30 2009] [error] [client xx.xx.xx.xx] Call stack (most recent first):, referer: http://example.com/mahara/view/blocks.php?new=1&id=6
[Thu Oct 29 02:36:30 2009] [error] [client xx.xx.xx.xx] * log_message("Constant INTERNAL already defined", 8, true, true, "/mahara/view/view.php", 27) at /mahara/lib/errors.php:378, referer: http://example.com/mahara/view/blocks.php?new=1&id=6
[Thu Oct 29 02:36:30 2009] [error] [client xx.xx.xx.xx] * error(8, "Constant INTERNAL already defined", "/mahara/view/view.php", 27, array(size 40)) at Unknown:0, referer: http://example.com/mahara/view/blocks.php?new=1&id=6
[Thu Oct 29 02:36:30 2009] [error] [client xx.xx.xx.xx] * define("INTERNAL", 1) at /mahara/view/view.php:27, referer: http://example.com/mahara/view/blocks.php?new=1&id=6
[Thu Oct 29 02:36:30 2009] [error] [client xx.xx.xx.xx] * require("/mahara/view/view.php") at /mahara/view/blocks.json.php:30, referer: http://example.com/mahara/view/blocks.php?new=1&id=6
[Thu Oct 29 02:36:30 2009] [error] [client xx.xx.xx.xx] , referer: http://example.com/mahara/view/blocks.php?new=1&id=6
[Thu Oct 29 02:36:30 2009] [error] [client xx.xx.xx.xx] PHP Fatal error: Cannot redeclare init_performance_info() (previously declared in /mahara/init.php:292) in /mahara/init.php on line 306, referer: http://example.com/mahara/view/blocks.php?new=1&id=6
=================

It might be related to require statements in PHP which have relative path (if any).

PHP 5.2.11
APC Version 3.1.2

Revision history for this message
Nigel-catalyst (nigel-catalyst) wrote :

Well that just sounds like a complete royal mess :)

Suggested solution: set apc.stat = 1. I severely doubt that this setting alone is going to make or break your server's performance for now.

If someone here gets around to testing with APC, then we can have a closer look at the issue, but it really does sound like APC is broken rather than Mahara.

Revision history for this message
Jai Gupta (jai-keytoschool) wrote :

No problem Nigel, thank you for your attention.

Yes, it might be that APC is broken or it might be PHP, I have no idea. Please let me know if you need more inputs from me.

PS: With the same environment we are running Moodle, Drupal, PhpBB with no errors.

Revision history for this message
Andrew Nicols (dobedobedoh) wrote :

Just for the record, I can replicate this bug on Debian Lenny running php
5.2.6 and APC version 3.0.19.

To confirm, if apc.stat = 0 with apc enabled, this bug appears.

I saw this when trying to create a view and trying to view a component in a different tab.

Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

Francois reckons we just need to exclude dataroot from the files that apc doesn't stat, because some php files are in there (dwoo cache, langpacks).

Changed in mahara:
milestone: none → 1.3.0
Changed in mahara:
assignee: nobody → François Marier (fmarier)
Revision history for this message
François Marier (fmarier) wrote :

Steps to reproduce on my setup:

1- put "apc.stat=0" in /etc/php5/conf.d/apc.ini

2- sudo /etc/init.d/php-fastcgi restart

The view editor is completely broken when apc.stat is turned off. It looks like the problem comes from Dwoo or Pieforms.

Revision history for this message
François Marier (fmarier) wrote :

It is apparently well known that smarty doesn't work with APC:

  http://www.tjlug.org/2009/04/22/apc-config-files/

so the fault here must be in the way that Dwoo caches its compiled templates.

Revision history for this message
François Marier (fmarier) wrote :

apc.filters="..." is the setting to prevent certain files from getting cached

Changed in mahara:
status: Confirmed → In Progress
Revision history for this message
François Marier (fmarier) wrote :

After trying (unsuccessfully) to blacklist certain files from being cached, it looks like APC is just broken and there's not really any way to fix this other than by turning apc.stat on.

More people discussing this problem:

  http://stackoverflow.com/questions/1834631/php-apc-filters-syntax
  http://stackoverflow.com/questions/1626262/apc-filters-by-path

So I'm going to look instead at detecting apc.stat=0 in Mahara and issuing a warning about it.

tags: added: performance
Changed in mahara:
status: In Progress → Fix Released
status: Fix Released → Fix Committed
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.