Skip to content

Watched variable changed #9

@w0rse

Description

@w0rse

We're encountering the following problem with cacheops on various places in our site. It all started after we changed wsgi settings (see below) to fight memory leaks. In particular, we blame added multithreading.

Traceback (most recent call last):

  File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  ...

  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 82, in __len__
    self._result_cache = list(self.iterator())

  File "/usr/lib/python2.6/site-packages/cacheops/query.py", line 327, in iterator
    self._cache_results(cache_key, results)

  File "/usr/lib/python2.6/site-packages/cacheops/query.py", line 231, in _cache_results
    cache_thing(self.model, cache_key, results, cond_dnf, timeout=self._cachetimeout)

  File "/usr/lib/python2.6/site-packages/cacheops/query.py", line 57, in cache_thing
    txn.execute()

  File "/usr/lib/python2.6/site-packages/redis/client.py", line 1515, in execute
    return execute(conn, stack)

  File "/usr/lib/python2.6/site-packages/redis/client.py", line 1465, in _execute_transaction
    raise WatchError("Watched variable changed.")

WatchError: Watched variable changed.

Here's out set up:

Apache/2.2.16
mod_wsgi/3.3
Python/2.6.7
cacheops/0.9.1

httpd.conf

WSGIDaemonProcess test processes=4 threads=15 maximum-requests=200 stack-size=1048576 display-name=%{GROUP}
WSGIProcessGroup test
WSGISocketPrefix /var/run/wsgi
WSGIRestrictEmbedded On

settings.py

CACHEOPS_REDIS = {
    'host': '127.0.0.1',
    'port': 6379,
    'db': 1,
    'socket_timeout': 3,
}

CACHEOPS = {
        '*.*': ('all', 60*15),
}

CACHES = {
    'default': {
        'BACKEND': 'redis_cache.RedisCache',
        'LOCATION': '127.0.0.1:6379',
        'OPTIONS': {
            'DB': 3,
            'PASSWORD': '',
            'PARSER_CLASS': DefaultParser
        },
    },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions