openedx-unsupported / devstack

Get up and running quickly to develop or extend Open edX services
GNU Affero General Public License v3.0
405 stars 424 forks source link

'HiddenDescriptorWithMixins' object has no attribute 'id' #78

Closed jmatsushita closed 7 years ago

jmatsushita commented 7 years ago

After install, when trying to navigate on the platform I get this error. There are a couple of messages on google groups about it (one mentionning a mongo lock file) and another mention in the openedx slack which seems like a good lead:

Richard Moch So: such error happens when the file requirement/edx/local.txt fails to install edx-platform as a Python package Posted in #generalDec 28th, 2016 at 4:56 PM

Will investigate more.

jmatsushita commented 7 years ago

That's the lms-stderr.log trace:

2017-03-31 11:32:14,294 INFO 63 [tracking] logger.py:50 - {"username": "staff", "event_type": "/courses/course-v1:edX+DemoX+Demo_Course/info", "ip": "127.0.0.1", "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36", "host": "37.218.242.181", "referer": "", "accept_language": "en-US,en;q=0.8,fr;q=0.6", "event": "{\"POST\": {}, \"GET\": {}}", "event_source": "server", "context": {"course_user_tags": {}, "user_id": 9, "org_id": "edX", "course_id": "course-v1:edX+DemoX+Demo_Course", "path": "/courses/course-v1:edX+DemoX+Demo_Course/info"}, "time": "2017-03-31T15:32:14.294416+00:00", "page": null}
2017-03-31 11:32:14,992 ERROR 63 [root] exceptions.py:16 - Uncaught exception from <class 'django.core.handlers.wsgi.WSGIHandler'>
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 145, in inner
    return func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 110, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/util/views.py", line 51, in inner
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/views/views.py", line 325, in course_info
    show_enroll_banner = request.user.is_authenticated() and not CourseEnrollment.is_enrolled(user, course.id)
AttributeError: 'HiddenDescriptorWithMixins' object has no attribute 'id'
Internal Server Error: /courses/course-v1:edX+DemoX+Demo_Course/info
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 145, in inner
    return func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 110, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/util/views.py", line 51, in inner
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/views/views.py", line 325, in course_info
    show_enroll_banner = request.user.is_authenticated() and not CourseEnrollment.is_enrolled(user, course.id)
AttributeError: 'HiddenDescriptorWithMixins' object has no attribute 'id'
2017-03-31 11:32:14,993 ERROR 63 [django.request] base.py:256 - Internal Server Error: /courses/course-v1:edX+DemoX+Demo_Course/info
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 145, in inner
    return func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 110, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/util/views.py", line 51, in inner
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/views/views.py", line 325, in course_info
    show_enroll_banner = request.user.is_authenticated() and not CourseEnrollment.is_enrolled(user, course.id)
AttributeError: 'HiddenDescriptorWithMixins' object has no attribute 'id'
jmatsushita commented 7 years ago

After running the steps from #79 :

And restarting all supervised services (didn't work without that) /edx/app/supervisor/venvs/supervisor/bin/supervisorctl restart all

This error went away. Keeping this open to try and get to the bottom of it! I'll reinstall from scratch and look at the log in more detail.

jmatsushita commented 7 years ago

@clintonb It would be useful to have a paver install_prereqs option to make the series of pip install not have the -q option, i.e. to make the pip install verbose. I've done this manually on my docker image, but maybe it'll be useful for other things and to troubleshoot devstack dependency problems in general. However, I gave a look at the JIRA and I don't know where to submit this. Do you think it would be useful?

Also while waiting for the make devstack.provision I looked at the provision.sh script and it seems that the initial provisioning depends on the edx-platform that's baked in the edxops/edxapp:devstack image and that the local cloned ../edx-platform is only mounted later on make devstack.start. Did I get this right? Could that be a cause of issues? Why not mount the cloned repos and provision from this?

clintonb commented 7 years ago

Any changes to the individual services should be addressed there (edx/edx-platform in this case). I'm happy to review PRs.

Regarding provisioning, that script was written prior to our splitting out Docker Sync and host volumes into separate files. We'll need to explore solutions there.

jmatsushita commented 7 years ago

Oh well... I ran another ./destroy.sh and make devstack.provision on the same machine and this time the platform courses do display properly without the HiddenDescriptorWithMixins error... as well as without the Studio asset compilation error.

I guess that this sequence of pip installs triggered by paver might be what's introducing non reproducibility here?

should be addressed there (edx/edx-platform in this case)

That's what's called PLAT on JIRA right?

Regarding provisioning, that script was written prior to our splitting out Docker Sync and host volumes into separate files. We'll need to explore solutions there.

I guess that when working from a branch (feature branch for instance) or a fork, then provisioning from the locally cloned source code would make sense no? It would be a matter of changing this line of provision.sh:

# Bring the rest of the services online
docker-compose up -d

to docker-compose -f docker-compose.yml -f docker-compose-host.yml up

Maybe adding a make devstack.provision.sync to override with devstack/docker-compose-sync.yml ?

jmatsushita commented 7 years ago

I've installed from scratch on OSX and got this error again.

I can confirm that only running the following 2 commands solved this particular issue (#79 needs the paver update_assets on the other hand):

pip install --disable-pip-version-check --exists-action w -r requirements/edx/local.txt
/edx/app/supervisor/venvs/supervisor/bin/supervisorctl restart all

In case this helps this is the stdout of the pip install run

# pip install --disable-pip-version-check --exists-action w -r requirements/edx/local.txt
Obtaining file:///edx/app/edxapp/edx-platform (from -r requirements/edx/local.txt (line 2))
Obtaining file:///edx/app/edxapp/edx-platform/common/lib/calc (from -r requirements/edx/local.txt (line 3))
Obtaining file:///edx/app/edxapp/edx-platform/common/lib/capa (from -r requirements/edx/local.txt (line 4))
Obtaining file:///edx/app/edxapp/edx-platform/common/lib/chem (from -r requirements/edx/local.txt (line 5))
Obtaining file:///edx/app/edxapp/edx-platform/common/lib/dogstats (from -r requirements/edx/local.txt (line 6))
Obtaining file:///edx/app/edxapp/edx-platform/common/lib/safe_lxml (from -r requirements/edx/local.txt (line 7))
Obtaining file:///edx/app/edxapp/edx-platform/common/lib/sandbox-packages (from -r requirements/edx/local.txt (line 8))
Obtaining file:///edx/app/edxapp/edx-platform/common/lib/symmath (from -r requirements/edx/local.txt (line 9))
Obtaining file:///edx/app/edxapp/edx-platform/common/lib/xmodule (from -r requirements/edx/local.txt (line 10))
Obtaining file:///edx/app/edxapp/edx-platform/openedx/core/lib/xblock_builtin/xblock_discussion (from -r requirements/edx/local.txt (line 12))
Requirement already satisfied: setuptools in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from Open-edX==0.6->-r requirements/edx/local.txt (line 2))
Requirement already satisfied: pyparsing==2.0.7 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from calc==0.2->-r requirements/edx/local.txt (line 3))
Requirement already satisfied: numpy==1.6.2 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from calc==0.2->-r requirements/edx/local.txt (line 3))
Requirement already satisfied: scipy==0.14.0 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from calc==0.2->-r requirements/edx/local.txt (line 3))
Requirement already satisfied: lxml in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from capa==0.1->-r requirements/edx/local.txt (line 4))
Requirement already satisfied: pytz in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from capa==0.1->-r requirements/edx/local.txt (line 4))
Requirement already satisfied: nltk==2.0.6 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from chem==0.1.1->-r requirements/edx/local.txt (line 5))
Requirement already satisfied: dogapi in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from dogstats-wrapper==0.1->-r requirements/edx/local.txt (line 6))
Requirement already satisfied: defusedxml in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from safe-lxml==1.0->-r requirements/edx/local.txt (line 7))
Requirement already satisfied: sympy==0.7.1 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from symmath==0.1->-r requirements/edx/local.txt (line 9))
Requirement already satisfied: docopt in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from XModule==0.1.1->-r requirements/edx/local.txt (line 10))
Requirement already satisfied: path.py in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from XModule==0.1.1->-r requirements/edx/local.txt (line 10))
Requirement already satisfied: webob in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from XModule==0.1.1->-r requirements/edx/local.txt (line 10))
Requirement already satisfied: edx-opaque-keys<1.0.0,>=0.4.0 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from XModule==0.1.1->-r requirements/edx/local.txt (line 10))
Requirement already satisfied: XBlock in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from xblock-discussion==0.1->-r requirements/edx/local.txt (line 12))
Requirement already satisfied: appdirs>=1.4.0 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from setuptools->Open-edX==0.6->-r requirements/edx/local.txt (line 2))
Requirement already satisfied: six>=1.10.0 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from setuptools->Open-edX==0.6->-r requirements/edx/local.txt (line 2))
Requirement already satisfied: packaging>=16.8 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from setuptools->Open-edX==0.6->-r requirements/edx/local.txt (line 2))
Requirement already satisfied: PyYAML>=3.09 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from nltk==2.0.6->chem==0.1.1->-r requirements/edx/local.txt (line 5))
Requirement already satisfied: decorator>=3.3.2 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from dogapi->dogstats-wrapper==0.1->-r requirements/edx/local.txt (line 6))
Requirement already satisfied: simplejson>=2.0.9 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from dogapi->dogstats-wrapper==0.1->-r requirements/edx/local.txt (line 6))
Requirement already satisfied: pymongo<4.0.0,>=2.7.2 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from edx-opaque-keys<1.0.0,>=0.4.0->XModule==0.1.1->-r requirements/edx/local.txt (line 10))
Requirement already satisfied: stevedore<2.0.0,>=0.14.1 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from edx-opaque-keys<1.0.0,>=0.4.0->XModule==0.1.1->-r requirements/edx/local.txt (line 10))
Requirement already satisfied: web-fragments in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from XBlock->xblock-discussion==0.1->-r requirements/edx/local.txt (line 12))
Requirement already satisfied: python-dateutil in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from XBlock->xblock-discussion==0.1->-r requirements/edx/local.txt (line 12))
Requirement already satisfied: fs in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from XBlock->xblock-discussion==0.1->-r requirements/edx/local.txt (line 12))
Requirement already satisfied: markupsafe in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from XBlock->xblock-discussion==0.1->-r requirements/edx/local.txt (line 12))
Requirement already satisfied: pbr>=1.6 in /edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages (from stevedore<2.0.0,>=0.14.1->edx-opaque-keys<1.0.0,>=0.4.0->XModule==0.1.1->-r requirements/edx/local.txt (line 10))
Requirement already satisfied: argparse in /usr/lib/python2.7 (from stevedore<2.0.0,>=0.14.1->edx-opaque-keys<1.0.0,>=0.4.0->XModule==0.1.1->-r requirements/edx/local.txt (line 10))
Installing collected packages: Open-edX, calc, capa, chem, dogstats-wrapper, safe-lxml, sandbox-packages, symmath, XModule, xblock-discussion
  Found existing installation: Open-edX 0.6
    Uninstalling Open-edX-0.6:
      Successfully uninstalled Open-edX-0.6
  Running setup.py develop for Open-edX
  Found existing installation: calc 0.2
    Uninstalling calc-0.2:
      Successfully uninstalled calc-0.2
  Running setup.py develop for calc
  Found existing installation: capa 0.1
    Uninstalling capa-0.1:
      Successfully uninstalled capa-0.1
  Running setup.py develop for capa
  Found existing installation: chem 0.1.1
    Uninstalling chem-0.1.1:
      Successfully uninstalled chem-0.1.1
  Running setup.py develop for chem
  Found existing installation: dogstats-wrapper 0.1
    Uninstalling dogstats-wrapper-0.1:
      Successfully uninstalled dogstats-wrapper-0.1
  Running setup.py develop for dogstats-wrapper
  Found existing installation: safe-lxml 1.0
    Uninstalling safe-lxml-1.0:
      Successfully uninstalled safe-lxml-1.0
  Running setup.py develop for safe-lxml
  Found existing installation: sandbox-packages 0.1.1
    Uninstalling sandbox-packages-0.1.1:
      Successfully uninstalled sandbox-packages-0.1.1
  Running setup.py develop for sandbox-packages
  Found existing installation: symmath 0.1
    Uninstalling symmath-0.1:
      Successfully uninstalled symmath-0.1
  Running setup.py develop for symmath
  Found existing installation: XModule 0.1.1
    Uninstalling XModule-0.1.1:
      Successfully uninstalled XModule-0.1.1
  Running setup.py develop for XModule
  Found existing installation: xblock-discussion 0.1
    Uninstalling xblock-discussion-0.1:
      Successfully uninstalled xblock-discussion-0.1
  Running setup.py develop for xblock-discussion
Successfully installed Open-edX XModule calc capa chem dogstats-wrapper safe-lxml sandbox-packages symmath xblock-discussion
macdiesel commented 7 years ago

I believe we now have how to work around this covered in the docs and with the latest tag on images. I would suggest a make stop;make pull;make dev.up should this be run in to again.