Hi, Before to explain the problem, below the configuration:
ReviewBoard version: 1.7.6 Django version: 1.4.5 Djblets version: 0.7.11 Apache used Memcache used (version 1.48, python lib) I developed some extensions for Reviewboard which are using TemplateHook and UrlHook, to add some HTML code on existing Reviewboard web pages. When i installed and enabled these extensions through administration web page, and users use the Reviewboard, some errors as below have been notified: (even after restarting apache, memcache, and users have refresh their web browser). *Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/handlers/base.py", line 89, in get_response response = middleware_method(request) File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/middleware.py", line 32, in process_request self._check_expired() File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/middleware.py", line 50, in _check_expired extension_manager.load(full_reload=True) File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/base.py", line 453, in load self._clear_extensions() File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/base.py", line 542, in _clear_extensions self._uninit_extension(extension) File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/base.py", line 595, in _uninit_extension extension.shutdown() File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/base.py", line 170, in shutdown hook.shutdown() File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/hooks.py", line 46, in shutdown super(URLHook, self).shutdown() File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/base.py", line 246, in shutdown self.__class__.remove_hook(self) File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/base.py", line 274, in remove_hook cls.hooks.remove(hook)ValueError: list.remove(x): x not in list* or *Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/handlers/base.py", line 89, in get_response response = middleware_method(request) File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/middleware.py", line 32, in process_request self._check_expired() File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/middleware.py", line 50, in _check_expired extension_manager.load(full_reload=True) File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/base.py", line 511, in load self._init_extension(ext_class) File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.11-py2.7.egg/djblets/extensions/base.py", line 580, in _init_extension extension.info.installed = extension.registration.installedAttributeError: 'MetricsExtension' object has no attribute 'registration'* I tried to find the problem and it seems to come from a cache issue. As i understood (please tell me if i well understood or not), for each HTTP request, the Djblet middleware (located in middleware.py file) checks if the extension manager is expired (_check_expired() method). In *djblets/extensions/middleware.py* file: *class ExtensionsMiddleware(object):... def process_request(self, request): self._check_expired() def _check_expired(self):... for extension_manager in get_extension_managers(): if extension_manager.is_expired(): extension_manager.load(full_reload=True)* In *djblets/extensions/base.py* file: *class ExtensionManager(object):... def is_expired(self): sync_gen = cache.get(self._sync_key) return (sync_gen is None or (type(sync_gen) is int and sync_gen != self._last_sync_gen))* If is *_expired()* returns True, all extensions are reloaded (extension_manager.load(full_reload=True) in _check_expired() method. And the problem seems to come during this reloading (see above error messages). So, is it possible to not execute the* extension_manager.load(full_reload=True)* method after each HTTP Request ? As to keep all the time the *_last_sync_gen* key of the extension manager in the cache. I don't understand why you need to put the key in cache, because when the extension is disabled or enabled, or when one of the parameter of the extension is changed, the key is updated. I noticed that only one key is generated and cached for all extensions (which are in the same extension manager). When the *_check_expired*() returns True, ALL extensions will be reloaded. So, if an another user of ReviewBoard at the same time is trying to display a web page where the extension is used, is it not a problem ? Because perhaps the extension is not yet full reloaded, which can create perhaps the above errors. Or is it an issue how i wrote the extensions ? Below one of the extension i created: *class MetricsExtension(Extension):... is_configurable = True has_admin_site = True... def __init__(self, *args, **kwargs): super(MetricsExtension, self).__init__(*args, **kwargs) URLHook(self, patterns('', (r'^rbmetrics/', include('rbmetrics.urls')))) TemplateHook(self, "base-scripts-post", "rbmetrics/metrics_init.html", apply_to=['view_diff', 'review-request-detail'])* Hope you understand my problem, because not very easy to explain and my english is so poor ... ;-) Regards, Vincent G. -- Get the Review Board Power Pack at http://www.reviewboard.org/powerpack/ --- Sign up for Review Board hosting at RBCommons: https://rbcommons.com/ --- Happy user? Let us know at http://www.reviewboard.org/users/ --- You received this message because you are subscribed to the Google Groups "reviewboard" group. To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.