[Django] #16358: cached_db session with memcached forgets big values

9 views
Skip to first unread message

Django

unread,
Jun 27, 2011, 4:07:14 AM6/27/11
to django-...@googlegroups.com
#16358: cached_db session with memcached forgets big values
-------------------------------------+-------------------------------------
Reporter: ccrisan | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Core (Cache system)
Version: 1.3 | Severity: Normal
Keywords: session cache memcached | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Considering **memcached's 1MB limit**, putting a value larger than 1MB
into a **cached_db** session will get written to **DB** but not to
**cache**. However a previous value for the session key already exists in
the cache, and thus the session gets restored with previous data from the
cache, instead of the new information stored in django_session table, in
the DB.
My guess is that the memcached backed should remove the key when not being
able to set it to the new value.

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

Django

unread,
Jun 27, 2011, 4:08:07 AM6/27/11
to django-...@googlegroups.com
#16358: cached_db session with memcached forgets big values
-------------------------------------+-------------------------------------
Reporter: ccrisan | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Core (Cache system)
Version: 1.3 | Severity: Normal
Resolution: | Keywords: session cache
Triage Stage: | memcached
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by ccrisan):

* cc: ccrisan (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
Jun 27, 2011, 12:52:50 PM6/27/11
to django-...@googlegroups.com
#16358: cached_db session with memcached forgets big values
-------------------------------------+-------------------------------------
Reporter: ccrisan | Owner: anonymous
Type: Bug | Status: assigned
Milestone: | Component: Core (Cache system)
Version: 1.3 | Severity: Normal
Resolution: | Keywords: session cache
Triage Stage: Accepted | memcached
Needs documentation: 0 | Has patch: 0
Patch needs improvement: 0 | Needs tests: 0
UI/UX: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by manfre):

* status: new => assigned
* owner: nobody => anonymous
* stage: Unreviewed => Accepted


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

Django

unread,
Jul 4, 2011, 10:40:16 AM7/4/11
to django-...@googlegroups.com
#16358: cached_db session with memcached forgets big values
-------------------------------------+-------------------------------------
Reporter: ccrisan | Owner: anonymous
Type: Bug | Status: assigned
Milestone: | Component: Core (Cache system)
Version: 1.3 | Severity: Normal
Resolution: | Keywords: session cache
Triage Stage: Accepted | memcached
Needs documentation: 0 | Has patch: 1
Patch needs improvement: 0 | Needs tests: 0
UI/UX: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by ccrisan):

* has_patch: 0 => 1


Comment:

I've attached a small simple patch for memcached.py. I'm not sure if this
is the right thing to to in this case. What should be a cache's behavior
in case of failure to set a key, anyways?

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

Django

unread,
Sep 9, 2011, 8:03:47 PM9/9/11
to django-...@googlegroups.com
#16358: cached_db session with memcached forgets big values
-------------------------------------+-------------------------------------
Reporter: ccrisan | Owner: anonymous
Type: Bug | Status: assigned
Milestone: | Component: Core (Cache system)
Version: SVN | Severity: Normal
Resolution: | Keywords: session cache
Triage Stage: Accepted | memcached
Needs documentation: 0 | Has patch: 1
Patch needs improvement: 1 | Needs tests: 1
UI/UX: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by adamnelson):

* needs_better_patch: 0 => 1
* version: 1.3 => SVN
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/16358#comment:4>

Django

unread,
Feb 24, 2013, 6:20:41 AM2/24/13
to django-...@googlegroups.com
#16358: cached_db session with memcached forgets big values
-------------------------------------+-------------------------------------
Reporter: ccrisan | Owner: anonymous
Type: Bug | Status: assigned
Component: Core (Cache system) | Version: master

Severity: Normal | Resolution:
Keywords: session cache | Triage Stage: Accepted
memcached | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by aaugustin):

This makes sense, could you:
- add a test case in `tests/regressiontests/cache/tests.py`?
- generate a single patch from the root of the Django repository (or make
a pull request)?

--
Ticket URL: <https://code.djangoproject.com/ticket/16358#comment:5>

Django

unread,
Nov 7, 2014, 12:03:12 AM11/7/14
to django-...@googlegroups.com
#16358: cached_db session with memcached forgets big values
-------------------------------------+-------------------------------------
Reporter: ccrisan | Owner: manfre

Type: Bug | Status: assigned
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: session cache | Triage Stage: Accepted
memcached | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by manfre):

* owner: anonymous => manfre
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0


Comment:

Added a test and a pull request.

--
Ticket URL: <https://code.djangoproject.com/ticket/16358#comment:6>

Django

unread,
Nov 11, 2014, 3:26:29 AM11/11/14
to django-...@googlegroups.com
#16358: cached_db session with memcached forgets big values
-------------------------------------+-------------------------------------
Reporter: ccrisan | Owner: manfre
Type: Bug | Status: assigned
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: session cache | Triage Stage: Ready for
memcached | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/16358#comment:7>

Django

unread,
Nov 13, 2014, 10:10:29 PM11/13/14
to django-...@googlegroups.com
#16358: cached_db session with memcached forgets big values
-------------------------------------+-------------------------------------
Reporter: ccrisan | Owner: manfre
Type: Bug | Status: closed
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution: fixed

Keywords: session cache | Triage Stage: Ready for
memcached | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Michael Manfre <mmanfre@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"bc8abe36ba5508fe788f6d49a26749268d368583"]:
{{{
#!CommitTicketReference repository=""
revision="bc8abe36ba5508fe788f6d49a26749268d368583"
Fixed #16358 - Made memcache backend delete old value on a failure to set.

Default Memcached configuration allows for a maximum object of 1MB and
will fail to set the key if it is too large. The key will be deleted from
memcached if it fails to be set. This is needed to avoid an issue with
cache_db session backend using the old value stored in memcached, instead
of the newer value stored in the database.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16358#comment:8>

Django

unread,
Nov 13, 2014, 10:10:29 PM11/13/14
to django-...@googlegroups.com
#16358: cached_db session with memcached forgets big values
-------------------------------------+-------------------------------------
Reporter: ccrisan | Owner: manfre
Type: Bug | Status: closed
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution: fixed
Keywords: session cache | Triage Stage: Ready for
memcached | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Michael Manfre <mmanfre@…>):

In [changeset:"a305695f28cb15165a19c3871aec878a230a5105"]:
{{{
#!CommitTicketReference repository=""
revision="a305695f28cb15165a19c3871aec878a230a5105"
Merge pull request #3481 from manfre/ticket-16358

Fixed #16358 - Made memcache backend delete old value on a failure to set.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16358#comment:9>

Reply all
Reply to author
Forward
0 new messages