Opened 9 months ago

Closed 3 months ago

#34806 closed Cleanup/optimization (fixed)

Make cached_db backend resilient to cache backend errors

Reported by: Claude Paroz Owned by: Sulabh Katila
Component: contrib.sessions Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


In the case storing the session data in the cache for the cached_db backend is failing, this should not make the whole request crash.

Use case: you add a big content to messages.success, bigger than what your configured cache backend can accept (e.g. obtaining a TooBig error with memcache). Then every future request from that session will crash.

I would suggest to log the failure instead of letting the cache backend exception crash the request, and continue with the request, as missing saving the session data in the cache is not a serious condition, it will only slow the requests a bit as the database will be hit each time until the issue is solved.

Change History (10)

comment:1 by Natalia Bidart, 9 months ago

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

Thanks Claude for the report.

Following the description, I agree that it makes sense to not fail the whole request when the storing in the cache fails. I couldn't find an older ticket for this issue, so I'm accepting it, though it would be great if you could provide a reproducer or test case to aid future contributors.

comment:2 by Sulabh Katila, 9 months ago

Owner: changed from nobody to Sulabh Katila
Status: newassigned

comment:3 by David Sanders, 9 months ago

Has patch: set
Needs documentation: set
Needs tests: set
Patch needs improvement: set

comment:4 by Sulabh Katila, 8 months ago

Needs tests: unset
Patch needs improvement: unset

comment:5 by David Sanders, 8 months ago

Patch needs improvement: set

comment:6 by Natalia Bidart, 7 months ago

Replied to PR questions and made an initial review, left comments.

comment:7 by Sulabh Katila, 4 months ago

Patch needs improvement: unset

comment:8 by Sulabh Katila, 3 months ago

Needs documentation: unset

comment:9 by Natalia Bidart, 3 months ago

Triage Stage: AcceptedReady for checkin

comment:10 by GitHub <noreply@…>, 3 months ago

Resolution: fixed
Status: assignedclosed

In eceb5e2:

Fixed #34806 -- Made cached_db session backend resilient to cache write errors.

Co-authored-by: Natalia <124304+nessita@…>

Note: See TracTickets for help on using tickets.
Back to Top