Closed Bug 1704038 Opened 7 months ago Closed 6 months ago

Upgrade to Django 3.2

Categories

(Webtools Graveyard :: Pontoon, enhancement, P3)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mathjazz, Assigned: pfischbeck)

Details

Attachments

(3 files)

Django 3.2 (LTS) is out. Let's upgrade!

https://docs.djangoproject.com/en/3.2/releases/3.2/

Assignee: nobody → pfischbeck
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED

Turns out there are at least a couple of other cases where we hit errors:

Translate page:

[2021-04-17 14:28:59 +0000] [13] [ERROR] Error handling request /zh-hk/all-projects/all-resources/?status=errors
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.8/site-packages/django/shortcuts.py", line 76, in get_object_or_404
    return queryset.get(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/db/models/query.py", line 435, in get
    raise self.model.DoesNotExist(
pontoon.base.models.Locale.DoesNotExist: Locale matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 544, in wrapper
    return wrapped(*args, **kwargs)
  File "/app/pontoon/translate/views.py", line 106, in translate
    locale = get_object_or_404(Locale, code=locale)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/shortcuts.py", line 78, in get_object_or_404
    raise Http404('No %s matches the given query.' % queryset.model._meta.object_name)
django.http.response.Http404: No Locale matches the given query.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 131, in get_exception_response
    callback = resolver.resolve_error_handler(status_code)
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 626, in wrapper
    callback, param_dict = wrapped(*args, **kwargs)
TypeError: cannot unpack non-iterable function object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
    response = response or self.get_response(request)
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 1203, in _wrapper
    return wrapped(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 49, in inner
    response = response_for_exception(request, exc)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 59, in response_for_exception
    response = get_exception_response(request, get_resolver(get_urlconf()), 404, exc)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 135, in get_exception_response
    response = handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 490, in wrapper
    return _wrapped(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 483, in _wrapped
    return wrapped(request, resolver, exc_info)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 152, in handle_uncaught_exception
    callback = resolver.resolve_error_handler(500)
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 626, in wrapper
    callback, param_dict = wrapped(*args, **kwargs)
TypeError: cannot unpack non-iterable function object

Contributor page:

[2021-04-17 14:27:47 +0000] [28] [ERROR] Error handling request /contributors/sozijh91dhrkmjapluullbjhsa0/
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.8/site-packages/django/shortcuts.py", line 76, in get_object_or_404
    return queryset.get(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/db/models/query.py", line 435, in get
    raise self.model.DoesNotExist(
django.contrib.auth.models.User.DoesNotExist: User matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 544, in wrapper
    return wrapped(*args, **kwargs)
  File "/app/pontoon/contributors/views.py", line 45, in contributor_username
    user = get_object_or_404(User, username=username)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/shortcuts.py", line 78, in get_object_or_404
    raise Http404('No %s matches the given query.' % queryset.model._meta.object_name)
django.http.response.Http404: No User matches the given query.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 131, in get_exception_response
    callback = resolver.resolve_error_handler(status_code)
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 626, in wrapper
    callback, param_dict = wrapped(*args, **kwargs)
TypeError: cannot unpack non-iterable function object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
    response = response or self.get_response(request)
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 1203, in _wrapper
    return wrapped(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 49, in inner
    response = response_for_exception(request, exc)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 59, in response_for_exception
    response = get_exception_response(request, get_resolver(get_urlconf()), 404, exc)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 135, in get_exception_response
    response = handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 490, in wrapper
    return _wrapped(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 483, in _wrapped
    return wrapped(request, resolver, exc_info)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 152, in handle_uncaught_exception
    callback = resolver.resolve_error_handler(500)
  File "/app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py", line 626, in wrapper
    callback, param_dict = wrapped(*args, **kwargs)
TypeError: cannot unpack non-iterable function object
Status: RESOLVED → REOPENED
Resolution: FIXED → ---

As far as I can tell, this means that for pages that throw an error anyways (e.g., unknown locale or contributor, as above), another error is thrown by newrelic during its error handling. This slipped through in testing because I don't know how to test newrelic locally.

The root cause is this change in Django (changing a method signature), which is then fixed by this newrelic commit.

In short, we need to update newrelic. I'll provide a PR. Please let me know if you found any other errors where the initial error was also unexpected.

Status: REOPENED → RESOLVED
Closed: 6 months ago6 months ago
Resolution: --- → FIXED
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.