Page MenuHomePhabricator

500 error when deleting ssh key from toolsadmin
Closed, ResolvedPublic

Description

When trying to delete a ssh key from my account via toolsadmin, I get a 500 error and no successful deletion:

500 Internal Server Error

An unexpected technical problem has occured while handing the requested URI /profile/settings/ssh-keys/delete. This is probably temporary and should be fixed soon. Please try again later.

Request ID
e0ccc6e957cc448d8b05b8b65f1ea897

Event Timeline

Change 505049 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[labs/striker@master] confirm_required: update for Django 2

https://gerrit.wikimedia.org/r/505049

The error messages are not showing up nicely in logstash because of json payload truncation (T151422), but the error that does show up looks like this:

@cee: {"message": "Internal Server Error: /profile/settings/ssh-keys/delete", "stack_trace": "Traceback (most recent call last):\n  File \"/srv/deployment/striker/venv/lib/python3.5/site-packages/django/core/handlers/exception.py\", line 34, in inner\n    response = get_response(request)\n  File \"/srv/deployment/striker/venv/lib/python3.5/site-packages/django/core/handlers/base.py\", line 126, in _get_response\n    response = self.process_exception_by_middleware(e, request)\n  File \"/srv/deployment/striker/venv/lib/python3.5/site-packages/django/core/handlers/base.py\", line 124, in _get_response\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\n  File \"/srv/deployment/striker/venv/lib/python3.5/site-packages/django/contrib/auth/decorators.py\", line 21, in _wrapped_view\n    return view_func(request, *args, **kwargs)\n  File \"./striker/decorators.py\", line 38, in decorated\n    return shortcuts.render_to_response(template_name, ctx)\n  File \"/srv/deployment/striker/venv/lib/python3.5/site-packages/django/shortcuts.py\", line 27, in render_to_response\n    content = loader.render_to_string(template_name, context, using=using)\n  File \"/srv/deployment/striker/venv/lib/python3.5/site-packages/django/template/loader.py\", line 62, in render_to_string\n    return template.render(context, request)\n  File \"/srv/deployment/striker/venv/lib/python3.5/site-packages/django/template/backends/django.py\", line 59, in render\n    context = make_context(context, request, autoescape=self.backend.engine.autoescape)\n  File \"/srv/deployment/striker/venv/lib/python3.5/site-packages/django/template/context.py\", line 270, in make_context\n    raise TypeError('context must be a dict rather than %s.' % context.__class__.__name__)\nTypeError: context must be a dict rather than RequestContext.\n", "tags": [], "type": "striker", "level": "ERROR", "process": 24337, "host": "labweb1002", "@version": "1", "stack_info": null, "path": "/srv/deployment/striker/venv/lib/python3.5/site-packages/django/utils

I had found this in local testing about a month ago and created a patch, but then I forgot about it in gerrit. :/ I'll try to get it deployed during the hackathon at some point, or early next week if I can't get it done while I'm traveling.

The formatted traceback is …

Traceback (most recent call last):
  File "/srv/deployment/striker/venv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/srv/deployment/striker/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/srv/deployment/striker/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/srv/deployment/striker/venv/lib/python3.5/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "./striker/decorators.py", line 38, in decorated
    return shortcuts.render_to_response(template_name, ctx)
  File "/srv/deployment/striker/venv/lib/python3.5/site-packages/django/shortcuts.py", line 27, in render_to_response
    content = loader.render_to_string(template_name, context, using=using)
  File "/srv/deployment/striker/venv/lib/python3.5/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/srv/deployment/striker/venv/lib/python3.5/site-packages/django/template/backends/django.py", line 59, in render
    context = make_context(context, request, autoescape=self.backend.engine.autoescape)
  File "/srv/deployment/striker/venv/lib/python3.5/site-packages/django/template/context.py", line 270, in make_context
    raise TypeError('context must be a dict rather than %s.' % context.__class__.__name__)
TypeError: context must be a dict rather than RequestContext.

Is anything holding back the gerrit patch?

Is anything holding back the gerrit patch?

Just my time and availability to work on this. As a work around, the ssh-key management features at Wikitech can be used until this bug gets fixed.

Change 505049 merged by jenkins-bot:
[labs/striker@master] confirm_required: update for Django 2

https://gerrit.wikimedia.org/r/505049

Change 523480 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[labs/striker/deploy@master] Bump submodules

https://gerrit.wikimedia.org/r/523480

Change 523480 merged by jenkins-bot:
[labs/striker/deploy@master] Bump submodules

https://gerrit.wikimedia.org/r/523480

Mentioned in SAL (#wikimedia-operations) [2019-07-16T21:15:56Z] <bd808@deploy1001> Started deploy [striker/deploy@247a8a6]: Fixes for ssh key management, git repo creation, and Django upgrade (T221657, T227508)

Mentioned in SAL (#wikimedia-operations) [2019-07-16T21:17:04Z] <bd808@deploy1001> Finished deploy [striker/deploy@247a8a6]: Fixes for ssh key management, git repo creation, and Django upgrade (T221657, T227508) (duration: 01m 08s)