#32844 closed Bug (wontfix)
Cached pages can crash on 3.1 to 3.2 upgrade
| Reported by: | Iuri de Silvio | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 3.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
My cached page from 3.1 crashes because I have a middleware setting a header.
Because cache_page do a pickle caching, we have a 3.1 JsonResponse running on 3.2, without the new headers feature.
AttributeError: 'JsonResponse' object has no attribute 'headers'
File "django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "commons/middleware.py", line 44, in __call__
response['X-Current-Version'] = VERSION
File "django/http/response.py", line 172, in __setitem__
self.headers[header] = value
Docs could provide some help about this, the fix should be easy cleaning specific cache or using CACHE_MIDDLEWARE_KEY_PREFIX. that is unfortunately broken.
Change History (3)
comment:1 by , 4 years ago
| Component: | Uncategorized → Documentation |
|---|---|
| Resolution: | → wontfix |
| Status: | new → closed |
| Type: | Uncategorized → Bug |
comment:2 by , 4 years ago
FWIW we've used the KEY_FUNCTION setting to namespace keys of CACHES entries doing rich object serde by Django major version to prevent these issues from happening. You have to be careful to do a progressive rollout to prevent cache miss stampedes but it completely avoids these kinds of issues.
comment:3 by , 4 years ago
I didn't knew about this KEY_FUNCTION.
It would be a problem in my case because we have other keys in the same cache, but not difficult to move to a different cache and use that.
Thanks!
Hi.
I can't see how that's ever going to be supported. The response API doesn't change often but if it does you'll have to clear the cache. You note this:
This seems a bit particular to merit specific documentation.