Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'HttpResponse' object has no attribute 'headers' #5919

Closed
raphaelm opened this issue Apr 25, 2021 · 5 comments
Closed

AttributeError: 'HttpResponse' object has no attribute 'headers' #5919

raphaelm opened this issue Apr 25, 2021 · 5 comments
Assignees
Labels
bug Something is broken.
Milestone

Comments

@raphaelm
Copy link

Hi there!

Describe the issue

We've just upgraded to docker tag 4.6-1 and our error log is full of errors like this:

uwsgi stderr | [2021-04-25 17:38:45,066: ERROR/475] Internal Server Error: /js/i18n/
uwsgi stderr | Traceback (most recent call last):
uwsgi stderr |   File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/exception.py", line 47, in inner
uwsgi stderr |     response = get_response(request)
uwsgi stderr |   File "/usr/local/lib/python3.7/dist-packages/weblate/middleware.py", line 276, in __call__
uwsgi stderr |     " ".join(font),
uwsgi stderr |   File "/usr/local/lib/python3.7/dist-packages/django/http/response.py", line 172, in __setitem__
uwsgi stderr |     self.headers[header] = value
uwsgi stderr | AttributeError: 'HttpResponse' object has no attribute 'headers'

Server configuration and status

 * Weblate: 4.6
 * Django: 3.2
 * siphashc: 2.1
 * translate-toolkit: 3.3.4
 * lxml: 4.6.3
 * Pillow: 8.2.0
 * bleach: 3.3.0
 * python-dateutil: 2.8.1
 * social-auth-core: 4.1.0
 * social-auth-app-django: 4.0.0
 * django-crispy-forms: 1.11.2
 * oauthlib: 3.1.0
 * django-compressor: 2.4.1
 * djangorestframework: 3.12.4
 * django-filter: 2.4.0
 * django-appconf: 1.0.4
 * user-agents: 2.2.0
 * filelock: 3.0.12
 * setuptools: 40.8.0
 * jellyfish: 0.8.2
 * openpyxl: 3.0.7
 * celery: 5.0.5
 * kombu: 5.0.2
 * translation-finder: 2.9
 * weblate-language-data: 2021.4
 * html2text: 2020.1.16
 * pycairo: 1.16.2
 * pygobject: 3.30.4
 * diff-match-patch: 20200713
 * requests: 2.25.1
 * django-redis: 4.12.1
 * hiredis: 2.0.0
 * sentry_sdk: 1.0.0
 * Cython: 0.29.23
 * misaka: 2.1.1
 * GitPython: 3.1.14
 * borgbackup: 1.1.16
 * pyparsing: 2.4.7
 * pyahocorasick: 1.4.2
 * Python: 3.7.3
 * Git: 2.20.1
 * psycopg2: 2.8.6
 * psycopg2-binary: 2.8.6
 * phply: 1.2.5
 * chardet: 4.0.0
 * ruamel.yaml: 0.17.4
 * tesserocr: 2.5.1
 * akismet: 1.1
 * boto3: 1.17.53
 * zeep: 4.0.0
 * aeidon: 1.9
 * iniparse: 0.5
 * mysqlclient: 2.0.3
 * Mercurial: 5.7.1
 * git-svn: 2.20.1
 * git-review: 2.0.0
 * Redis server: 4.0.12
 * PostgreSQL server: 11.10
 * Database backends: django.db.backends.postgresql
 * Cache backends: default:RedisCache, avatar:FileBasedCache
 * Email setup: django.core.mail.backends.smtp.EmailBackend: mail.rami.io
 * OS encoding: filesystem=utf-8, default=utf-8
 * Celery: redis://redis:6379/1, redis://redis:6379/1, regular
 * Platform: Linux 4.19.0-8-amd64 (x86_64)
@nijel
Copy link
Member

nijel commented Apr 25, 2021

I've seen this as well, and it seems to be related to caching and Django upgrade to 3.2, but I didn't investigate further yet. The errors did disappear for me shortly after the upgrade.

@sentry-io
Copy link

sentry-io bot commented Apr 25, 2021

Sentry issue: WEBLATE-6DK

@raphaelm
Copy link
Author

raphaelm commented Apr 25, 2021

Confirmed, they vanished 15-20 minutes after the upgrade. Feel free to close this if you don't want to investigate further.

@nijel nijel self-assigned this Apr 26, 2021
@nijel nijel added the bug Something is broken. label Apr 26, 2021
@nijel nijel added this to the 4.7 milestone Apr 26, 2021
@nijel
Copy link
Member

nijel commented Apr 26, 2021

I know what happens - our middleware is trying to modify the cached response from previous version. I think Django should discard the cache on version change here, but the similar thing can happen on Weblate upgrade, so let's assume that Django would be upgraded together with Weblate.

@nijel nijel closed this as completed in 21dc501 Apr 26, 2021
@github-actions
Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

@nijel nijel modified the milestones: 4.7, 4.6.1 Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken.
Projects
None yet
Development

No branches or pull requests

2 participants