Error Memcached WSGI

hi
I use seafile server pro 6.1.9 and since I upgraded fastcgi to wsgi I have memcached errors.

Log seahub.log:
2017-10-05 05:41:39,819 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:throttle_user_2): Transport endpoint is not connected
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/django_pylibmc/memcached.py”, line 130, in get
return super(PyLibMCCache, self).get(key, default, version)
File “/home/cloud/seafile-pro-server-6.1.9/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/cache/backends/memcached.py”, line 84, in get
val = self._cache.get(key)
Error: error 26 from memcached_get(:1:throttle_user_2): Transport endpoint is not connected
2017-10-05 05:43:50,974 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:throttle_ping_78.201.79.63): Transport endpoint is not connected
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/django_pylibmc/memcached.py”, line 130, in get
return super(PyLibMCCache, self).get(key, default, version)
File “/home/cloud/seafile-pro-server-6.1.9/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/cache/backends/memcached.py”, line 84, in get
val = self._cache.get(key)
Error: error 26 from memcached_get(:1:throttle_ping_78.201.79.63): Transport endpoint is not connected
2017-10-05 05:43:51,599 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:throttle_user_2): Transport endpoint is not connected
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/django_pylibmc/memcached.py”, line 130, in get
return super(PyLibMCCache, self).get(key, default, version)
File “/home/cloud/seafile-pro-server-6.1.9/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/cache/backends/memcached.py”, line 84, in get
val = self._cache.get(key)
Error: error 26 from memcached_get(:1:throttle_user_2): Transport endpoint is not connected

Config seahub_settings.py:
CACHES = {
‘default’: {
‘BACKEND’: ‘django_pylibmc.memcached.PyLibMCCache’,
‘LOCATION’: ‘127.0.0.1:11211’,
}
}

thank you for helping me

Have you checked all the dependencies for Python and Django?

sudo pip install pylibmc

sudo pip install django-pylibmc

root@seafile:~# sudo pip install django-pylibmc
Requirement already satisfied: django-pylibmc in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: pylibmc>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from django-pylibmc)
root@seafile:~#

1 Like

Is

sudo apt-get install libmemcached-dev

OK?

root@seafile:~# apt-get install libmemcached-dev
Lecture des listes de paquets… Fait
Construction de l’arbre des dépendances
Lecture des informations d’état… Fait
libmemcached-dev is already the newest version (1.0.18-4.1).
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
root@seafile:~#

Any other experiences on this? I’d like to know before update…
But hey, is WSGI already officially supported/inclued?
Thanks!

Hmm… Everything is coming up good.

Can you do:

pip list --format=columns

so I can compare to what I’m running (CE 6.1.2/ Ubuntu)? Thanks!

By the way, what OS are you running?

Looks to me like switching to wsgi is fraught with peril. This is not an isolated post.

In any case if you’re anticipating going to 6.2 it’s probably a good idea to get your server on wsgi first (IMHO).

Best approach is to get running wsgi with 6.1.x and then upgrade.

@Cisco try to revert to the old memcache. It looks like that this will be most probably the issue you are having.

  • The old configuration is like:

      CACHES = {
      'default': {
          'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
          'LOCATION': '127.0.0.1:11211'
      }
      }
    

or change 'LOCATION': 'unix:/var/run/memcached.sock' if you communicate through socket (performanter than port)

@Jochen yes, wsgi is the propossed official way.

2 Likes

Hi
@mercury I use debian 9 on my server

@jobenvil thanks, your solution solved my problem :smile:

Please add this to the manual if it’s useful for the whole community. :slight_smile:

Wow!
Great Idea :slight_smile:
I just changed everything accordingly and works like charm so far.
If anyone likes to adapt this along with “New” PyLibMCCache backend you need to remove the “Unix:” in front of the location path so that your config looks like:

CACHES = {
    'default': {
        'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
        'LOCATION': '/tmp/memcached.sock',
    }
}

Yeah i just moved it to /tmp :wink:

correct, when using PyLibMCCache and bind to unix socket is mandatory to remove the “unix:” I did read this yesterday as well but I was not able to discover which advantage is changing from the old MemcachedCache to the PyLibMCCache. Both are cache based in memory. If someone is able to discover these advantages, please post them in Forum.

I think I have no rights to change the manual :slight_smile:

Anyone can submit a PR :wink:

Repo is named haiwen/seafile-docs

2 Likes

you catch me :slight_smile:
Edit: I have sent the PR here

2 Likes

Some time ago i’ve already seen that discussion right here:

I haven’t checked for it yet. Makes sense so far but why are our servers still ok with the old type if its actually not compatible anymore.:thinking:

Thanks to point this out! I see now.

I checked the django framework that we are actually using on seahub_thirdpart -which is in fact the 1.8.18 and is still compatible with our both configurations. :hushed:

desigual@thor ~/env_seafile/dev/seahub_thirdpart $ cat easy-install.pth
import sys; sys.__plen = len(sys.path)
./pytz-2016.1-py2.7.egg
./django_statici18n-1.1.3-py2.7.egg
./django_appconf-1.0.1-py2.7.egg
./djangorestframework-3.3.2-py2.7.egg
./django_compressor-1.4-py2.7.egg
./jsonfield-1.0.3-py2.7.egg
./django_post_office-2.0.6-py2.7.egg
./gunicorn-19.4.5-py2.7.egg
./flup-1.0.2-py2.7.egg
./chardet-2.3.0-py2.7.egg
./python_dateutil-1.5-py2.7.egg
./django_picklefield-0.3.2-py2.7.egg
./django_constance-1.0.1-py2.7.egg
./jdcal-1.2-py2.7.egg
./et_xmlfile-1.0.1-py2.7.egg
./openpyxl-2.3.0-py2.7.egg
./Django-1.8.18-py2.7.egg
./futures-3.1.1-py2.7.egg
./six-1.10.0-py2.7.egg
./qrcode-5.3-py2.7.egg
./django_formtools-2.0-py2.7.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

It’s maybe still compatible, but we saw some errors / warnings in the logs while using the old config.

ah, Ok, let’s check the logfiles for a while and come here to review. Thanks!