Error Memcached WSGI

Do I need to create that file? Or just change the line?
It’s not clear for me if should create that file or give seafile user any new rights regarding Tmp dir.

@marcusm

Does this not work for you?

LOCATION’: ‘127.0.0.1:11211’,

Please see: https://manual.seafile.com/deploy/add_memcached.html

Did install
sudo apt-get install libmemcached-dev zlib1g-dev

Also did install
sudo -H pip install pylibmc
sudo -H pip install django-pylibmc

Added this to seahub_settings.py

CACHES = {
    'default': {
        'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
        'LOCATION': '127.0.0.1:11211',
    }
}

but I still get this error messages in

2017-11-02 18:58:18,269 [ERROR] django.pylibmc:132 get MemcachedError: error 47 from memcached_get(:1:TEXT_PREVIEW_EXT): (0x7fdba8005f90) SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETR$
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/seafile/nohatech/seafile-server-6.2.2/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/cache/backends/memcached.py", line 84, in get
    val = self._cache.get(key)
ServerDown: error 47 from memcached_get(:1:TEXT_PREVIEW_EXT): (0x7fdba8005f90) SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY,  host: 127.0.0.1:11211 -> libmemcached/get.cc:314
1 Like

Did you install memcached?

sudo apt-get install memcached

Well I did not, I did’ent find it in the manual that I should install that so I dident know.

But now everything seem to work great :slight_smile:
No error in seahub.log anyway :slight_smile:

whats the difference with /tmp/memcached.sock and LOCATION’: ‘127.0.0.1:11211’, ?

I’m running the latest Seafile CE 6.2.2 what should I use?

Did send in a PR about it troug github so lets hope that the dev’s are changing so memcached and zlib1g-dev are in the manual also added the -H flag for the pip installations.

I did read that best practices was to use ‘LOCATION’: ‘/tmp/memcached.sock’, but do I need to install something else or create the file? Or can I just change the line in the configuration?

Yes, memcached configuration file must be adapted to work on socket instead of port.

Do you have any instructions how to do that?

Search in Google for memcached socket configuration or similars.

1 Like

HI,

just to let you know, on Debian 8 i had to install all this :

sudo apt-get install python-dev
sudo apt-get install libmemcached-dev zlib1g-dev
sudo pip install pylibmc
sudo pip install django-pylibmc

Memcache seems to work fine on WCGI with this config (i looked at the manua)

CACHES = {
    'default': {
        'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
        'LOCATION': '127.0.0.1:11211',
    }
}

I never managed to make memcache work before …

Regards,

Gautier

1 Like

Hi,
Use unix_socket instead it’s 30% faster.
You don’t need to install anything more just change the configs.
Read how to do it in the link in this post, look at the add memcache section.

You just need to change memcache.conf and the seahub_settings.py

1 Like

HI, I tried your confg and i have the errors in seahub.log

2017-11-12 17:41:19,969 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:CUR_TOPINFO): Broken pipe
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/cc/seafile/seafile-pro-server-6.2.0/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:CUR_TOPINFO): Broken pipe
2017-11-12 17:41:20,361 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:CUR_TOPINFO): Broken pipe
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/cc/seafile/seafile-pro-server-6.2.0/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:CUR_TOPINFO): Broken pipe

The seahub server is running and it does it fast.
The file /var/run/memcached.sock exists.
Why setting the process to be run by root ?

Regards,

Gautier

Have you also looked so you have everything that you need installed?
It’s some packeage that are needed.

I’m on my mobile now but take a look in the beginning of my guide to se what package that are needed.

Your running it as root because that I have putted it in /vat/run folder.

If you want it to run as an other user you need to change the permissions for the socket file.

Sorry for misspelling etc I’m on my cellphone until tomorrow.

Edit:
So you have this installed?
Sudo apt-get install python-memcache memcached libmemcached-dev zlib1g-dev

Also
sudo -H pip install pillow moviepy pylibmc django-pylibmc -y

Yes i have.
But it seems that the log does not trace any more error about memcache.
I’ll keep you informed if it still occurs.

Regards
Gautier

Now when your mention it, did you stop Seafile before you did change memcached?
./seafile.sh stop and also ./seahub.sh stop?
I guess you did not stop memcached service either before you did make the changes?
I need to add that to the guide, that you need to stop Memcached service before changing the configuration file for memcached.

So this is the explanation, you need to stop memcached before your doing the changes and after you need to start memcached and also reload memcached.

My advice now is that you reboot the server and then take a look so everything looks good in the configuration files for memcached etc.

Edit:
I have now edited the github also I did try to do the exact same thing that you did without using “sudo service memcached stop” and I did get the same error in the log-file as you.

So it should not be a issue as long as you reboot your server so you know that the new configuration are running or, using sudo service memcached status then you should se if it using unix_sock

● memcached.service - memcached daemon
   Loaded: loaded (/lib/systemd/system/memcached.service; enabled)
   Active: active (running) since dim. 2017-11-12 18:40:50 CET; 4h 40min ago
 Main PID: 498 (memcached)
   CGroup: /system.slice/memcached.service
           └─498 /usr/bin/memcached -m 64 -u root -s /var/run/memcached.sock -a 0766 -M

Everything looks fine now.

Regards,

Gautier

1 Like

Hi,

I still have these errors from time to time, but it looks like it is not related to browsing on seahub.

Is there any way to diagnose them ?

2017-11-13 12:39:00,261 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:CUR_TOPINFO): Broken pipe
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/cc/seafile/seafile-pro-server-6.2.0/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:CUR_TOPINFO): Broken pipe

regards

One quastion have you tried to update/upgrade your system and reboot?
Sudo apt-get update && sudo apt-get upgrade -y

and then do a sudo reboot

hi
I am on debian 9 and I meet the same error as you Gautier I have no idea of the origin of these errors. errors appear using the seafile interface on the web browser

2017-11-13 07:34:59,397 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:CUR_TOPINFO): Broken pipe
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.2.0/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:CUR_TOPINFO): Broken pipe

It maybe are some error that are isloated on 6.2.0 version of Seafile, I’m using 6.2.2

Can you try to run this command sudo -H pip install pylibmc --upgrade and also sudo -H pip install django-pylibmc --upgrade

I was thinking if you have a old version of this two.