#35757: memcached.PyMemcacheCache reentrancy problem with ASGI-based runserver -------------------------------+-------------------------------------- Reporter: Harm Verhagen | Owner: (none) Type: Uncategorized | Status: closed Component: Uncategorized | Version: 5.1 Severity: Normal | Resolution: invalid Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------------------------- Comment (by Harm Verhagen):
I reproduced this problem with a small Django project. It seems to be related with channels (v3) Please advise, if Django related (if so, could you reopen the ticket?) I created a new project according the to polls example. The problem occurs when adding 'channels' to `INSTALLED_APPS` (without even using channels). polls.views.py {{{#!python from django.http import HttpResponse from django.core.cache import cache def incr(): key = 'example:key' try: val = cache.incr(key, 1) except ValueError: cache.set(key, 1) val = 1 return val def index(request): v = incr() return HttpResponse("Hello, world. You're at the polls index. %d" % v) }}} settings.py {{{#!python CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache', # 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', # using LocMemCache 'fixes' the problem 'LOCATION': "localhost:11211" }, } INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'channels', # adding this line shows the problem, removing this line 'fixes' the problem ] ASGI_APPLICATION = "mysite.asgi.application" # required for channels }}} Steps to reproduce, run the following script get_parallel.sh {{{#!bash #!/bin/bash # # do requests in parallel #https://code.djangoproject.com/ticket/35757 url='http://localhost:8000/polls/' curl $url& curl $url& curl $url& curl $url }}} -- Ticket URL: <https://code.djangoproject.com/ticket/35757#comment:12> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/01070192432783cf-64ba27ab-76f0-4bbb-96e4-398da4c2bc02-000000%40eu-central-1.amazonses.com.