@MoisesGonzalezS @dave
We’re receiving this error from the LMS often in our logs concerning pymongo.errors.ServerSelectionTimeoutError: No replica set members found yet
. Any way that you could supply us with your Django configuration for MongoDB?
LMS Log Error
tutor_local-lms-1 | During handling of the above exception, another exception occurred:
tutor_local-lms-1 |
tutor_local-lms-1 | Traceback (most recent call last):
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
tutor_local-lms-1 | response = get_response(request)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/crum/__init__.py", line 97, in __call__
tutor_local-lms-1 | response = self.get_response(request)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 49, in inner
tutor_local-lms-1 | response = response_for_exception(request, exc)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 114, in response_for_exception
tutor_local-lms-1 | response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 153, in handle_uncaught_exception
tutor_local-lms-1 | return callback(request)
tutor_local-lms-1 | File "/openedx/edx-platform/common/djangoapps/util/views.py", line 95, in wrapper
tutor_local-lms-1 | return func(request, *args, **kwargs)
tutor_local-lms-1 | File "/openedx/edx-platform/./lms/djangoapps/static_template_view/views.py", line 129, in render_500
tutor_local-lms-1 | return HttpResponseServerError(render_to_string('static_templates/server-error.html', {}, request=request))
tutor_local-lms-1 | File "/openedx/edx-platform/common/djangoapps/edxmako/shortcuts.py", line 178, in render_to_string
tutor_local-lms-1 | return template.render(dictionary, request)
tutor_local-lms-1 | File "/openedx/edx-platform/common/djangoapps/edxmako/template.py", line 82, in render
tutor_local-lms-1 | return self.mako_template.render_unicode(**context_dictionary)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/mako/template.py", line 478, in render_unicode
tutor_local-lms-1 | return runtime._render(
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 878, in _render
tutor_local-lms-1 | _render_context(
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 920, in _render_context
tutor_local-lms-1 | _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 947, in _exec_template
tutor_local-lms-1 | callable_(context, *args, **kwargs)
tutor_local-lms-1 | File "/tmp/mako_lms/f1543ed24543a70de2c17ebfc03bb76a/main.html.py", line 357, in render_body
tutor_local-lms-1 | runtime._include_file(context, (static.get_template_path('header.html')), _template_uri, online_help_token=online_help_token)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 795, in _include_file
tutor_local-lms-1 | callable_(ctx, **kwargs)
tutor_local-lms-1 | File "/tmp/mako_lms/f1543ed24543a70de2c17ebfc03bb76a/header.html.py", line 34, in render_body
tutor_local-lms-1 | runtime._include_file(context, (static.get_template_path(relative_path='header/header.html')), _template_uri, online_help_token=online_help_token)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 795, in _include_file
tutor_local-lms-1 | callable_(ctx, **kwargs)
tutor_local-lms-1 | File "/tmp/mako_lms/f1543ed24543a70de2c17ebfc03bb76a/header/header.html.py", line 113, in render_body
tutor_local-lms-1 | runtime._include_file(context, 'navbar-authenticated.html', _template_uri, online_help_token=online_help_token)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 795, in _include_file
tutor_local-lms-1 | callable_(ctx, **kwargs)
tutor_local-lms-1 | File "/tmp/mako_lms/f1543ed24543a70de2c17ebfc03bb76a/choose-aerospace/lms/templates/header/navbar-authenticated.html.py", line 111, in render_body
tutor_local-lms-1 | runtime._include_file(context, 'user_dropdown.html', _template_uri)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/mako/runtime.py", line 795, in _include_file
tutor_local-lms-1 | callable_(ctx, **kwargs)
tutor_local-lms-1 | File "/tmp/mako_lms/f1543ed24543a70de2c17ebfc03bb76a/header/user_dropdown.html.py", line 56, in render_body
tutor_local-lms-1 | resume_block = retrieve_last_sitewide_block_completed(self.real_user)
tutor_local-lms-1 | File "/openedx/edx-platform/./openedx/core/djangoapps/user_api/accounts/utils.py", line 171, in retrieve_last_sitewide_block_completed
tutor_local-lms-1 | item = modulestore().get_item(candidate_block_key, depth=1)
tutor_local-lms-1 | File "/openedx/edx-platform/common/lib/xmodule/xmodule/modulestore/mixed.py", line 82, in inner
tutor_local-lms-1 | retval = func(field_decorator=strip_key_collection, *args, **kwargs)
tutor_local-lms-1 | File "/openedx/edx-platform/common/lib/xmodule/xmodule/modulestore/mixed.py", line 248, in get_item
tutor_local-lms-1 | return store.get_item(usage_key, depth, **kwargs)
tutor_local-lms-1 | File "/openedx/edx-platform/common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py", line 283, in get_item
tutor_local-lms-1 | return super().get_item(usage_key, depth=depth, **kwargs)
tutor_local-lms-1 | File "/openedx/edx-platform/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py", line 1171, in get_item
tutor_local-lms-1 | with self.bulk_operations(usage_key.course_key):
tutor_local-lms-1 | File "/opt/pyenv/versions/3.8.12/lib/python3.8/contextlib.py", line 113, in __enter__
tutor_local-lms-1 | return next(self.gen)
tutor_local-lms-1 | File "/openedx/edx-platform/common/lib/xmodule/xmodule/modulestore/__init__.py", line 186, in bulk_operations
tutor_local-lms-1 | self._begin_bulk_operation(course_id, ignore_case)
tutor_local-lms-1 | File "/openedx/edx-platform/common/lib/xmodule/xmodule/modulestore/__init__.py", line 251, in _begin_bulk_operation
tutor_local-lms-1 | self._start_outermost_bulk_operation(bulk_ops_record, course_key, ignore_case)
tutor_local-lms-1 | File "/openedx/edx-platform/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py", line 245, in _start_outermost_bulk_operation
tutor_local-lms-1 | bulk_write_record.initial_index = self.db_connection.get_course_index(course_key, ignore_case=ignore_case)
tutor_local-lms-1 | File "/openedx/edx-platform/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py", line 374, in get_course_index
tutor_local-lms-1 | return self.course_index.find_one(query)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/mongodb_proxy.py", line 55, in wrapper
tutor_local-lms-1 | return func(*args, **kwargs)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/collection.py", line 1273, in find_one
tutor_local-lms-1 | for result in cursor.limit(-1):
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/cursor.py", line 1156, in next
tutor_local-lms-1 | if len(self.__data) or self._refresh():
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/cursor.py", line 1050, in _refresh
tutor_local-lms-1 | self.__session = self.__collection.database.client._ensure_session()
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1810, in _ensure_session
tutor_local-lms-1 | return self.__start_session(True, causal_consistency=False)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1763, in __start_session
tutor_local-lms-1 | server_session = self._get_server_session()
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1796, in _get_server_session
tutor_local-lms-1 | return self._topology.get_server_session()
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/topology.py", line 487, in get_server_session
tutor_local-lms-1 | self._select_servers_loop(
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/topology.py", line 208, in _select_servers_loop
tutor_local-lms-1 | raise ServerSelectionTimeoutError(
tutor_local-lms-1 | pymongo.errors.ServerSelectionTimeoutError: No replica set members found yet
tutor_local-lms-1 |
tutor_local-lms-1 | During handling of the above exception, another exception occurred:
tutor_local-lms-1 |
tutor_local-lms-1 | Traceback (most recent call last):
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/mongodb_proxy.py", line 55, in wrapper
tutor_local-lms-1 | return func(*args, **kwargs)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/collection.py", line 1273, in find_one
tutor_local-lms-1 | for result in cursor.limit(-1):
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/cursor.py", line 1156, in next
tutor_local-lms-1 | if len(self.__data) or self._refresh():
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/cursor.py", line 1050, in _refresh
tutor_local-lms-1 | self.__session = self.__collection.database.client._ensure_session()
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1810, in _ensure_session
tutor_local-lms-1 | return self.__start_session(True, causal_consistency=False)
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1763, in __start_session
tutor_local-lms-1 | server_session = self._get_server_session()
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1796, in _get_server_session
tutor_local-lms-1 | return self._topology.get_server_session()
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/topology.py", line 487, in get_server_session
tutor_local-lms-1 | self._select_servers_loop(
tutor_local-lms-1 | File "/openedx/venv/lib/python3.8/site-packages/pymongo/topology.py", line 208, in _select_servers_loop
tutor_local-lms-1 | raise ServerSelectionTimeoutError(
tutor_local-lms-1 | pymongo.errors.ServerSelectionTimeoutError: No replica set members found yet
We are configuring our Django configuration like so. I’m only showing the LMS configuration, however, the only difference between the following and the CMS is that the CMS has the "read_preference": "PRIMARY_PREFERRED"
. Note that I have only seen the error above in the LMS logs. I’m thinking that this is a write issue with the modulestore. Please advise. We can change the LMS to have "read_preference": "PRIMARY_PREFERRED"
as well.
>>> settings.MODULESTORE
{
"default": {
"ENGINE": "xmodule.modulestore.mixed.MixedModuleStore",
"OPTIONS": {
"mappings": {},
"stores": [
{
"NAME": "split",
"ENGINE": "xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore",
"DOC_STORE_CONFIG": {
"db": "openedx",
"host": "shard-00-02.1spck.mongodb.net:27017,shard-00-00.1spck.mongodb.net:27017,shard-00-01.1spck.mongodb.net:27017",
"replicaSet": "atlas-8mdjf4-shard-0",
"user": "edxapp",
"port": 443,
"collection": "modulestore",
"ssl": True,
"socketTimeoutMS": 6000,
"connectTimeoutMS": 2000,
"auth_source": "admin",
"read_preference": "SECONDARY_PREFERRED",
"password": "hidden",
"authsource": "admin",
"retryWrites": True,
"w": "majority",
},
"OPTIONS": {
"default_class": "xmodule.hidden_module.HiddenDescriptor",
"fs_root": "/openedx/data/modulestore",
"render_template": "common.djangoapps.edxmako.shortcuts.render_to_string",
},
},
{
"NAME": "draft",
"ENGINE": "xmodule.modulestore.mongo.DraftMongoModuleStore",
"DOC_STORE_CONFIG": {
"db": "openedx",
"host": "shard-00-02.1spck.mongodb.net:27017,shard-00-00.1spck.mongodb.net:27017,shard-00-01.1spck.mongodb.net:27017",
"replicaSet": "atlas-8mdjf4-shard-0",
"user": "edxapp",
"port": 443,
"collection": "modulestore",
"ssl": True,
"socketTimeoutMS": 6000,
"connectTimeoutMS": 2000,
"auth_source": "admin",
"read_preference": "SECONDARY_PREFERRED",
"password": "hidden",
"authsource": "admin",
"retryWrites": True,
"w": "majority",
},
"OPTIONS": {
"default_class": "xmodule.hidden_module.HiddenDescriptor",
"fs_root": "/openedx/data/modulestore",
"render_template": "common.djangoapps.edxmako.shortcuts.render_to_string",
},
},
],
},
}
}