madalinoprea / magneto-varnish

Magento extension that implements full page caching using Varnish
http://moprea.ro/2011/may/6/magento-performance-optimization-varnish-cache-3/
123 stars 36 forks source link

Could not flush cache or do some change in backend. #26

Open kevin25 opened 11 years ago

kevin25 commented 11 years ago

I got this erro when flushed the cache:

There has been an error processing your request

Mage registry key "_singleton/varnish/observer" already exists

Trace:

0 /var/www/html/app/Mage.php(192): Mage::throwException('Mage registry k...')

1 /var/www/html/app/Mage.php(446): Mage::register('_singleton/varn...', false)

2 /var/www/html/app/code/core/Mage/Core/Model/App.php(1208): Mage::getSingleton('varnish/observe...')

3 /var/www/html/app/Mage.php(416): Mage_Core_Model_App->dispatchEvent('http_response_s...', Array)

4 /var/www/html/app/code/core/Mage/Core/Controller/Response/Http.php(74): Mage::dispatchEvent('http_response_s...', Array)

5 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Front.php(188): Mage_Core_Controller_Response_Http->sendResponse()

6 /var/www/html/app/code/core/Mage/Core/Model/App.php(304): Mage_Core_Controller_Varien_Front->dispatch()

7 /var/www/html/app/Mage.php(596): Mage_Core_Model_App->run(Array)

8 /var/www/html/index.php(80): Mage::run('', 'store')

9 {main}

Also varnish cache cart and checkout. I am using magento 1.4.

Thanks

kevin25 commented 11 years ago

When i tried to uninstall it, it got this

Not enough arguments (no action specified)

madalinoprea commented 11 years ago

It looks like the module was not properly installed, is not able to find the class of 'varnish/observer' and tries to store in registry false. Do you see any configs defined by module in admin? (checking if is properly installed)

kevin25 commented 11 years ago

I installed it without error, but when i came to flush cache to activate the module, i got that error. And i could uninstall also.

madalinoprea commented 11 years ago

It seems that Magento loaded module's config and registered the observer for http_response_send_before. But when it's trying to instantiate an object for varnish/observer uri (defined via the same config) has some problems.

An idea is to add some debugging code or use xdebug to identify the pace where you it goes crazy. Check Mage_Core_Model_Config, I would expect to see $className = 'Magneto_Varnish_Model_Observer' and class_exists failing.

public function getModelInstance($modelClass='', $constructArguments=array()) { $className = $this->getModelClassName($modelClass); if (class_exists($className)) {

I assume you're having a single server, the default cache backend (files), nothing uber fancy.

kevin25 commented 11 years ago

Here it is public function getModelInstance($modelClass='', $constructArguments=array()) { $className = $this->getModelClassName($modelClass); if (class_exists($className)) { Varien_Profiler::start('CORE::create_object_of::'.$className); $obj = new $className($constructArguments); Varien_Profiler::stop('CORE::create_object_of::'.$className); return $obj; } else {

throw Mage::exception('Mage_Core', Mage::helper('core')->__('Model class does not exist: %s.', $modelClass));

        return false;
    }
}
kevin25 commented 11 years ago

Any idea? This is very urgent. Thanks!