Opened 11 years ago

Closed 11 years ago

#20176 closed Uncategorized (duplicate)

cache.set() fails silently

Reported by: mali@… Owned by: nobody
Component: Core (Cache system) Version: 1.5
Severity: Normal Keywords:
Cc: bmispelon@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

BaseMemcachedCache throws the result of its internal .set() away, so there is no feedback on whether it failed or not. I just spent day trying to figure out why my site was falling over and why the pages weren't getting cached. This is potentially deadly since it lulls you into thinking you have more capacity than you actually have.

I know this was discussed before as per: https://code.djangoproject.com/ticket/17249 but the behavior here is especially egregious. Can we at least gather thoughts on how we might handle this?

I understand why exceptions are not possible to do without breaking compat. Maybe we could have a check_success flag? Or maybe we could have a config option for cache to except? Simply returning True / False is also an option that'd be backwards compatible and backend agnostic.

I'll start enumerating backends I know in terms of returning success and maybe people can help:
python-memcached returns nonzero on success. https://github.com/linsomniac/python-memcached/blob/master/memcache.py#L563
pylibmc seems to have access to the data (https://github.com/simplegeo/pylibmc/blob/master/_pylibmcmodule.c#L289) but doesn't return it https://github.com/simplegeo/pylibmc/blob/master/pylibmc.py#L58
db cache?
filesystem?
locmem?

Also, is it terribly wrong to say "if your backend doesn't support success reports, we'll return None"?

Cheers, and thanks in advance.

Change History (2)

comment:1 by mali@…, 11 years ago

Has patch: unset

comment:2 by Baptiste Mispelon, 11 years ago

Cc: bmispelon@… added
Resolution: duplicate
Status: newclosed

Hi,

As you noted, this issue has already been reported so there is no need to create a new ticket.

The original ticket (#17249) has been closed by a core developer 17 months ago.

If you feel strongly about this and have ideas on how to improve the situation, consider writing a proposal to the django-developers mailing list (https://groups.google.com/forum/?fromgroups#!forum/django-developers).

Keep in mind that you will need to somehow address backwards-compatibility issues if you want to get this included.

If you get positive feedback on your ideas, feel free to reopen the original ticket.

Thanks.

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