[Django] #32844: Cached pages can crash on 3.1 to 3.2 upgrade

54 views
Skip to first unread message

Django

unread,
Jun 12, 2021, 1:00:30 PM6/12/21
to django-...@googlegroups.com
#32844: Cached pages can crash on 3.1 to 3.2 upgrade
------------------------------------------+------------------------
Reporter: Iuri de Silvio | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
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.

https://code.djangoproject.com/ticket/32841

--
Ticket URL: <https://code.djangoproject.com/ticket/32844>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 15, 2021, 3:32:53 AM6/15/21
to django-...@googlegroups.com
#32844: Cached pages can crash on 3.1 to 3.2 upgrade
--------------------------------+--------------------------------------

Reporter: Iuri de Silvio | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 3.2
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by Carlton Gibson):

* status: new => closed
* resolution: => wontfix
* component: Uncategorized => Documentation
* type: Uncategorized => Bug


Comment:

Hi.

> ...we have a 3.1 JsonResponse running on 3.2...

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:

> ...fix should be easy cleaning specific cache...

This seems a bit particular to merit specific documentation.

--
Ticket URL: <https://code.djangoproject.com/ticket/32844#comment:1>

Django

unread,
Jun 15, 2021, 1:09:18 PM6/15/21
to django-...@googlegroups.com
#32844: Cached pages can crash on 3.1 to 3.2 upgrade
--------------------------------+--------------------------------------

Reporter: Iuri de Silvio | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 3.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------

Comment (by Simon Charette):

FWIW we've used the `KEY_FUNCTION`
[https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-CACHES-
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/32844#comment:2>

Django

unread,
Jun 16, 2021, 9:27:13 AM6/16/21
to django-...@googlegroups.com
#32844: Cached pages can crash on 3.1 to 3.2 upgrade
--------------------------------+--------------------------------------

Reporter: Iuri de Silvio | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 3.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------

Comment (by Iuri de Silvio):

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!

--
Ticket URL: <https://code.djangoproject.com/ticket/32844#comment:3>

Reply all
Reply to author
Forward
0 new messages