jazkarta / obsolete-edx-sga

OBSOLETE - moved to https://github.com/mitodl/edx-sga
1 stars 119 forks source link

500 error trying to view students' uploaded files #15

Open pdpinch opened 10 years ago

pdpinch commented 10 years ago

When trying to "grade" file uploads made by myself and Carson to "SGA past due" I'm getting a 500 errors. I wouldn't be surprised if this is due to the change in the file storage scheme.

URLs in question:

https://sandbox0r.mitx.mit.edu/courses/MITx/edx4edx/edx4edx/xblock/i4x:;_;_MITx;_edx4edx;_edx_sga;_54ea0c73c5f34cd6ac6a1553ded1147e/handler/staff_download?module_id=715

https://sandbox0r.mitx.mit.edu/courses/MITx/edx4edx/edx4edx/xblock/i4x:;_;_MITx;_edx4edx;_edx_sga;_54ea0c73c5f34cd6ac6a1553ded1147e/handler/staff_download?module_id=719

carsongee commented 10 years ago

I ran down the stack trace, it is:

2014-05-19 08:54:18,986 ERROR 7936 [root] exceptions.py:9 - 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 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/module_render.py", line 627, in handle_xblock_callback
    return _invoke_xblock_handler(request, course_id, usage_id, handler, suffix, request.user)
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/module_render.py", line 697, in _invoke_xblock_handler
    resp = instance.handle(handler, req, suffix)
  File "/edx/app/edxapp/venvs/edxapp/src/xblock/xblock/core.py", line 284, in handle
    return self.runtime.handle(self, handler_name, request, suffix)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 960, in handle
    return super(MetricsMixin, self).handle(block, handler_name, request, suffix=suffix)
  File "/edx/app/edxapp/venvs/edxapp/src/xblock/xblock/runtime.py", line 643, in handle
    results = handler(request, suffix)
  File "/edx/app/edxapp/venvs/edxapp/src/edx-sga/edx_sga/sga.py", line 300, in staff_download
    state['uploaded_filename'])
  File "/edx/app/edxapp/venvs/edxapp/src/edx-sga/edx_sga/sga.py", line 316, in download
    file = default_storage.open(path)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/files/storage.py", line 33, in open
    return self._open(name, mode)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/storages/backends/s3boto.py", line 258, in _open
    raise IOError('File does not exist: %s' % name)
IOError: File does not exist: MITx/edx4edx/edx_sga/54ea0c73c5f34cd6ac6a1553ded1147e/59b20e4ebc96d3a64ffa7063983e73eed37cdb36.psd

So it is due to changing the way we named files and shouldn't come up again. That said, it would be nice to handle missing files with a more informative error message than a 500. I'll let Peter determine priority on that.

chrisrossi commented 10 years ago

I've gone ahead and removed the P1 label since, as noted above, this is unlikely to come up in practice. Graceful handling of missing uploads is still something to look at, though, but it is probably not urgent.