November 27, 2020

Open edX Discussion Forum Not Working

The problem is that the discussion forum is not working properly, forum service been restart every after 1 minutes.

I find this on forum log:

ERROR: ElasticSearch configuration validation failed. "rake search:validate_index" failed with the following message: Alias 'content' does not exist.
/edx/app/forum/.gem/ruby/2.5.0/gems/elasticsearch-transport-1.1.2/lib/elasticsearch/transport/transport/base.rb:52: warning: constant ::Fixnum is deprecated
/edx/app/forum/.gem/ruby/2.5.0/gems/elasticsearch-transport-1.1.2/lib/elasticsearch/transport/transport/base.rb:54: warning: constant ::Fixnum is deprecated
ERROR: ElasticSearch configuration validation failed. "rake search:validate_index" failed with the following message: Alias 'content' does not exist.
/edx/app/forum/.gem/ruby/2.5.0/gems/elasticsearch-transport-1.1.2/lib/elasticsearch/transport/transport/base.rb:52: warning: constant ::Fixnum is deprecated
/edx/app/forum/.gem/ruby/2.5.0/gems/elasticsearch-transport-1.1.2/lib/elasticsearch/transport/transport/base.rb:54: warning: constant ::Fixnum is deprecated
ERROR: ElasticSearch configuration validation failed. "rake search:validate_index" failed with the following message: Alias 'content' does not exist.
/edx/app/forum/.gem/ruby/2.5.0/gems/elasticsearch-transport-1.1.2/lib/elasticsearch/transport/transport/base.rb:52: warning: constant ::Fixnum is deprecated
/edx/app/forum/.gem/ruby/2.5.0/gems/elasticsearch-transport-1.1.2/lib/elasticsearch/transport/transport/base.rb:54: warning: constant ::Fixnum is deprecated
ERROR: ElasticSearch configuration validation failed. "rake search:validate_index" failed with the following message: Alias 'content' does not exist.

Find this logs on LMS log:

'Sep 27 14:08:27 ubuntu [service_variant=lms][edx.courseware][env:sandbox] ERROR [ubuntu 423] [views.py:575] - Error in /courses/course-v1:AUTH+Prog1+2018_T2/discussion/forum/: user=XXX, effective_user=XXX, course=course-v1:XXX+Devx+2020_Run1
Traceback (most recent call last):
File “/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/views/views.py”, line 506, in get
return super(CourseTabView, self).get(request, course=course, page_context=page_context, **kwargs)
File “/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/web_fragments/views.py”, line 26, in get
fragment = self.render_to_fragment(request, **kwargs)
File “/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/views/views.py”, line 640, in render_to_fragment
return tab.render_to_fragment(request, course, **kwargs)
File “/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/tabs.py”, line 294, in render_to_fragment
return self.fragment_view.render_to_fragment(request, course_id=unicode(course.id), **kwargs)
File “/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/views.py”, line 697, in render_to_fragment
base_context = _create_base_discussion_view_context(request, course_key)
File “/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/views.py”, line 404, in _create_base_discussion_view_context
user_info = cc_user.to_dict()
File “/edx/app/edxapp/edx-platform/lms/lib/comment_client/models.py”, line 59, in to_dict
self.retrieve()
File “/edx/app/edxapp/edx-platform/lms/lib/comment_client/models.py”, line 64, in retrieve
self._retrieve(*args, **kwargs)
File “/edx/app/edxapp/edx-platform/lms/lib/comment_client/user.py”, line 152, in _retrieve
metric_tags=self._metric_tags,
File “/edx/app/edxapp/edx-platform/lms/lib/comment_client/utils.py”, line 119, in perform_request
content=response.text[:100]
CommentClientError: Invalid JSON response for request zE8Dd4nm-1f6b-x9sq-7sh2-3Twjj0sqBzMs; first 100 characters: ’

And the issue has been fixed after execute this:

# Stop forum service.
sudo /edx/bin/supervisorctl stop forum

# Login to forum env.
sudo -sHu forum bash
cd ~/cs_comments_service/
source ~/forum_env

# Run-1
rake search:rebuild_index

# Or run this when Run-1 is not working
rake search:initialize

# Start the forum service
sudo /edx/bin/supervisorctl start forum

References: