[Django] #37210: Failed deletes in cached_db session backend should log, just like failed writes

4 views
Skip to first unread message

Django

unread,
Jul 8, 2026, 12:42:22 PM (19 hours ago) Jul 8
to django-...@googlegroups.com
#37210: Failed deletes in cached_db session backend should log, just like failed
writes
------------------------------+--------------------------------------------
Reporter: Jacob Walls | Type: Bug
Status: new | Component: contrib.sessions
Version: 5.1 | Severity: Normal
Keywords: not-security | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
------------------------------+--------------------------------------------
The Security Team closed a report about the cached_db session backend, but
in so doing, we noticed that we
[https://docs.djangoproject.com/en/dev/topics/http/sessions/#:~:text=If%20writing%20to%20the%20cache%20fails%2C%20the%20exception%20is%20handled%20and%20logged%20via%20the%20sessions%20logger%2C%20to%20avoid%20failing%20an%20otherwise%20successful%20write%20operation
recently documented] logging any such exceptions for failed writes.

We should handle failed deletes as well, see #34806, which only touched
`save()`, not `delete()`. (Starting off as "bug" since the docs imply no
save-versus-delete distinction, to my ear.)

Thanks LocalHost for the informative report.
--
Ticket URL: <https://code.djangoproject.com/ticket/37210>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 8, 2026, 12:56:54 PM (19 hours ago) Jul 8
to django-...@googlegroups.com
#37210: Failed deletes in cached_db session backend should log, just like failed
writes
----------------------------------+------------------------------------
Reporter: Jacob Walls | Owner: (none)
Type: Bug | Status: new
Component: contrib.sessions | Version: 5.1
Severity: Normal | Resolution:
Keywords: not-security | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by Natalia Bidart):

* stage: Unreviewed => Accepted

Comment:

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

Django

unread,
1:37 AM (6 hours ago) 1:37 AM
to django-...@googlegroups.com
#37210: Failed deletes in cached_db session backend should log, just like failed
writes
----------------------------------+------------------------------------
Reporter: Jacob Walls | Owner: Vismay
Type: Bug | Status: assigned
Component: contrib.sessions | Version: 5.1
Severity: Normal | Resolution:
Keywords: not-security | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by Vismay):

* owner: (none) => Vismay
* status: new => assigned

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

Django

unread,
1:49 AM (6 hours ago) 1:49 AM
to django-...@googlegroups.com
#37210: Failed deletes in cached_db session backend should log, just like failed
writes
----------------------------------+------------------------------------
Reporter: Jacob Walls | Owner: Vismay
Type: Bug | Status: assigned
Component: contrib.sessions | Version: 5.1
Severity: Normal | Resolution:
Keywords: not-security | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by Vismay):

* has_patch: 0 => 1

Comment:

Opened PR: https://github.com/django/django/pull/21606

I reproduced the cache delete failure locally and added sync/async
regression tests. The PR makes cached_db delete failures non-fatal and
logs them consistently with save failures.
--
Ticket URL: <https://code.djangoproject.com/ticket/37210#comment:3>
Reply all
Reply to author
Forward
0 new messages