Traceback (most recent call last): File "/var/local/env-allura/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/registry.py", line 409, in streaming_iter for item in self.application(environ, start_response): File "/var/local/env-allura/lib/python2.7/site-packages/Ming-0.2.2dev_20120202-py2.7.egg/ming/orm/middleware.py", line 16, in __call__ result = self.app(environ, start_response) File "/var/local/allura/Allura/allura/lib/custom_middleware.py", line 41, in __call__ return self.app(environ, start_response) File "/var/local/allura/Allura/allura/config/middleware.py", line 153, in SchemeMiddleware return app(environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/EasyWidgets-0.2dev_20110726-py2.7.egg/ew/middleware.py", line 65, in __call__ result = self.app(environ, start_response) File "/var/local/allura/Allura/allura/lib/custom_middleware.py", line 151, in __call__ resp = req.get_response(self.app) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1086, in get_response application, catch_exc_info=False) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1055, in call_application app_iter = application(self.environ, start_response) File "/var/local/allura/Allura/allura/config/middleware.py", line 162, in AlluraGlobalsMiddleware return app(environ, start_response) File "/var/local/allura/Allura/allura/lib/custom_middleware.py", line 120, in __call__ return self._app(environ, session_start_response) File "/var/local/allura/Allura/allura/lib/custom_middleware.py", line 200, in __call__ resp = req.get_response(self.app, catch_exc_info=self.debug) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1086, in get_response application, catch_exc_info=False) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1055, in call_application app_iter = application(self.environ, start_response) File "/var/local/allura/Allura/allura/lib/custom_middleware.py", line 78, in __call__ self.app, environ, catch_exc_info=True) File "/var/local/env-allura/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/util.py", line 48, in call_wsgi_application app_iter = application(environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/middleware.py", line 163, in __call__ self.app, new_environ, catch_exc_info=True) File "/var/local/env-allura/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/util.py", line 48, in call_wsgi_application app_iter = application(environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/WebError-0.10.3-py2.7.egg/weberror/errormiddleware.py", line 156, in __call__ return self.application(environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/Beaker-1.5.4-py2.7.egg/beaker/middleware.py", line 152, in __call__ return self.wrap_app(environ, session_start_response) File "/var/local/env-allura/lib/python2.7/site-packages/Routes-1.12.3-py2.7.egg/routes/middleware.py", line 131, in __call__ response = self.app(environ, start_response) File "/var/local/forge-classic/sfx/middleware.py", line 37, in __call__ resp = request.get_response(self.app) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1086, in get_response application, catch_exc_info=False) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1055, in call_application app_iter = application(self.environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/wsgiapp.py", line 106, in __call__ controller = self.resolve(environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/wsgiapp.py", line 239, in resolve return self.find_controller(controller) File "/var/local/env-allura/lib/python2.7/site-packages/TurboGears2-2.1.3-py2.7.egg/tg/wsgiapp.py", line 37, in find_controller __import__(full_module_name) File "/var/local/allura/Allura/allura/controllers/root.py", line 28, in <module> from .project import NeighborhoodController, HostNeighborhoodController File "/var/local/allura/Allura/allura/controllers/project.py", line 36, in <module> class W: File "/var/local/allura/Allura/allura/controllers/project.py", line 39, in W add_project = plugin.ProjectRegistrationProvider.get().add_project_widget(antispam=True) File "/var/local/allura/Allura/allura/lib/plugin.py", line 280, in get return app_globals.Globals().entry_points['registration'][method]() File "/var/local/forge-classic/sfx/sfx_main.py", line 140, in __init__ self.api = SFXProjectApi() File "/var/local/forge-classic/sfx/lib/sfx_api.py", line 147, in __init__ n = M.Neighborhood.query.get(name='Users') File "/var/local/env-allura/lib/python2.7/site-packages/Ming-0.2.2dev_20120202-py2.7.egg/ming/orm/mapper.py", line 264, in get return self.find(kwargs).first() File "/var/local/env-allura/lib/python2.7/site-packages/Ming-0.2.2dev_20120202-py2.7.egg/ming/orm/ormsession.py", line 320, in first return self.next() File "/var/local/allura/Allura/allura/lib/stats.py", line 57, in inner return func(*l, **kw) File "/var/local/env-allura/lib/python2.7/site-packages/Ming-0.2.2dev_20120202-py2.7.egg/ming/orm/ormsession.py", line 273, in next return self._next_impl() File "/var/local/env-allura/lib/python2.7/site-packages/Ming-0.2.2dev_20120202-py2.7.egg/ming/orm/ormsession.py", line 252, in _next_impl doc = self.ming_cursor.next() File "/var/local/env-allura/lib/python2.7/site-packages/Ming-0.2.2dev_20120202-py2.7.egg/ming/base.py", line 56, in next doc = self.cursor.next() File "/var/local/allura/Allura/allura/lib/stats.py", line 57, in inner return func(*l, **kw) File "/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.1.1-py2.7-linux-x86_64.egg/pymongo/cursor.py", line 703, in next if len(self.__data) or self._refresh(): File "/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.1.1-py2.7-linux-x86_64.egg/pymongo/cursor.py", line 666, in _refresh self.__uuid_subtype)) File "/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.1.1-py2.7-linux-x86_64.egg/pymongo/cursor.py", line 628, in __send_message self.__tz_aware) File "/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.1.1-py2.7-linux-x86_64.egg/pymongo/helpers.py", line 99, in _unpack_response raise AutoReconnect("master has changed") AutoReconnect: master has changed
And the gutenberg trace from the reactor/taskd service:
16:06:28,602 ERROR [allura.command] Taskd, restart in 10s Traceback (most recent call last): File "/var/local/allura/Allura/allura/command/taskd.py", line 66, in worker list(wsgi_app(r.environ, start_response)) File "/var/local/env-allura/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/registry.py", line 409, in streaming_iter for item in self.application(environ, start_response): File "/var/local/env-allura/lib/python2.7/site-packages/Ming-0.2.2dev_20120202-py2.7.egg/ming/orm/middleware.py", line 16, in __call__ result = self.app(environ, start_response) File "/var/local/allura/Allura/allura/lib/custom_middleware.py", line 41, in __call__ return self.app(environ, start_response) File "/var/local/allura/Allura/allura/config/middleware.py", line 153, in SchemeMiddleware return app(environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/EasyWidgets-0.2dev_20110726-py2.7.egg/ew/middleware.py", line 65, in __call__ result = self.app(environ, start_response) File "/var/local/allura/Allura/allura/lib/custom_middleware.py", line 151, in __call__ resp = req.get_response(self.app) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1086, in get_response application, catch_exc_info=False) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1055, in call_application app_iter = application(self.environ, start_response) File "/var/local/allura/Allura/allura/config/middleware.py", line 162, in AlluraGlobalsMiddleware return app(environ, start_response) File "/var/local/allura/Allura/allura/lib/custom_middleware.py", line 120, in __call__ return self._app(environ, session_start_response) File "/var/local/allura/Allura/allura/lib/custom_middleware.py", line 200, in __call__ resp = req.get_response(self.app, catch_exc_info=self.debug) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1086, in get_response application, catch_exc_info=False) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1055, in call_application app_iter = application(self.environ, start_response) File "/var/local/allura/Allura/allura/lib/custom_middleware.py", line 78, in __call__ self.app, environ, catch_exc_info=True) File "/var/local/env-allura/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/util.py", line 48, in call_wsgi_application app_iter = application(environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/middleware.py", line 163, in __call__ self.app, new_environ, catch_exc_info=True) File "/var/local/env-allura/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/util.py", line 48, in call_wsgi_application app_iter = application(environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/WebError-0.10.3-py2.7.egg/weberror/errormiddleware.py", line 156, in __call__ return self.application(environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/Beaker-1.5.4-py2.7.egg/beaker/middleware.py", line 152, in __call__ return self.wrap_app(environ, session_start_response) File "/var/local/env-allura/lib/python2.7/site-packages/Routes-1.12.3-py2.7.egg/routes/middleware.py", line 131, in __call__ response = self.app(environ, start_response) File "/var/local/forge-classic/sfx/middleware.py", line 37, in __call__ resp = request.get_response(self.app) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1086, in get_response application, catch_exc_info=False) File "/var/local/env-allura/lib/python2.7/site-packages/WebOb-1.1.1-py2.7.egg/webob/request.py", line 1055, in call_application app_iter = application(self.environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/wsgiapp.py", line 107, in __call__ response = self.dispatch(controller, environ, start_response) File "/var/local/env-allura/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/wsgiapp.py", line 312, in dispatch return controller(environ, start_response) File "/var/local/allura/Allura/allura/controllers/task.py", line 11, in __call__ result = task(restore_context=False) File "/var/local/allura/Allura/allura/model/monq_model.py", line 219, in __call__ self.result = func(*self.args, **self.kwargs) File "/var/local/allura/Allura/allura/tasks/event_tasks.py", line 11, in event t(event_type, *args, **kwargs) File "/var/local/forge-classic/sfx/sfx_main.py", line 225, in project_updated api.update(pylons.c.user, pylons.c.project) File "/var/local/forge-classic/sfx/lib/sfx_api.py", line 230, in update self._update_gutenberg(p) File "/var/local/forge-classic/sfx/lib/sfx_api.py", line 351, in _update_gutenberg 'shortname': p.get_tool_data('sfx', 'unix_group_name')}) File "/var/local/allura/Allura/allura/lib/stats.py", line 57, in inner return func(*l, **kw) File "/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.1.1-py2.7-linux-x86_64.egg/pymongo/collection.py", line 520, in find_one for result in self.find(spec_or_id, *args, **kwargs).limit(-1): File "/var/local/allura/Allura/allura/lib/stats.py", line 57, in inner return func(*l, **kw) File "/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.1.1-py2.7-linux-x86_64.egg/pymongo/cursor.py", line 703, in next if len(self.__data) or self._refresh(): File "/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.1.1-py2.7-linux-x86_64.egg/pymongo/cursor.py", line 666, in _refresh self.__uuid_subtype)) File "/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.1.1-py2.7-linux-x86_64.egg/pymongo/cursor.py", line 628, in __send_message self.__tz_aware) File "/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.1.1-py2.7-linux-x86_64.egg/pymongo/helpers.py", line 99, in _unpack_response raise AutoReconnect("master has changed") AutoReconnect: master has changed
Diff:
On ming rc/3806, there is a new option when configuring your datastore/engine (use_auto_retry).
QA:
Then move to validation and make a change in production.ini to add the use_auto_retry=True value to the Ming config.
We should also test how the reactor process handles gutenberg autoreconnects (forge-classic event handler)
In order to QA this properly I need instructions for how to repro the problem on a sandbox. I tried setting up a 2-node + arbiter replica set and still couldn't reproduce it. When master goes offline I get "connection refused". When that node is restarted I get "not master". If I promote it back to master, normal functionality resumes.
I don't know how to prove this code fixes anything if I can't repro the problem. Trying to repro with:
On a related note, I attempted to get failover working properly with
Ming-0.2.2dev_20120305
. First I applied this patch to Ming:Then I changed the Ming config in
production.ini
like so:With these changes in place, I got automatic failover when restarting nodes in the replica set. Now I'm wondering if this is all we need, instead of the new AutoRetryConnection.
Thoughts?
Using a ReplicaSetConnection connection with "secondary" read preference would be good. My only concern with that is the pre-2.1.0 notice on http://www.mongodb.org/display/DOCS/Indexing+as+a+Background+Operation I suppose when secondaries are blocking, queries could still go to the primary, but we'd want to confirm.
Marking invalid as per:
Related
Tickets:
#3806