Problem Seahub Django

Hi. I set the seahub configuration file ‘seahub_settings.py’ to use memcached. During startup you have the following problems:.
I installed the following packages:

pip install pylibmc django django-pylibmc python-memcached
apt-get install memcached libmemacached-dev
And here is also the seahub_settings configuration file:

# -*- coding: utf-8 -*-
SECRET_KEY = "MYKEY"
FILE_SERVER_ROOT = 'https://192.168.1.81/seafhttp'

THUMBNAIL_ROOT = '/tmp/thumbnails/'
#ENABLE_VIDEO_THUMBNAIL = False
#THUMBNAIL_VIDEO_FRAME_TIME = 5

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'MYEMAIL'
EMAIL_HOST_PASSWORD = 'MYPASSWORD'
EMAIL_PORT = 587

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

Error log:

ServerDown: error 47 from memcached_add: (0x555e5943ed70) SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY,  socket: /var/run/memcached.sock -> libmemcached/connect.cc:720
2019-04-18 20:58:29,606 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:CUR_TOPINFO): Broken pipe
Traceback (most recent call last):
  File "/home/cloudhome/.local/lib/python2.7/site-packages/django_pylibmc/memcached.py", line 130, in get
    return super(PyLibMCCache, self).get(key, default, version)
  File "/home/cloudhome/cloud/seafile/seafile-server-6.2.5/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
2019-04-18 20:58:29,688 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:throttle_user_3): Broken pipe
Traceback (most recent call last):
  File "/home/cloudhome/.local/lib/python2.7/site-packages/django_pylibmc/memcached.py", line 130, in get
    return super(PyLibMCCache, self).get(key, default, version)
  File "/home/cloudhome/cloud/seafile/seafile-server-6.2.5/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_3): Broken pipe
2019-04-18 21:04:48,666 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:throttle_user_3): Broken pipe
Traceback (most recent call last):
  File "/home/cloudhome/.local/lib/python2.7/site-packages/django_pylibmc/memcached.py", line 130, in get
    return super(PyLibMCCache, self).get(key, default, version)
  File "/home/cloudhome/cloud/seafile/seafile-server-6.2.5/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_3): Broken pipe

How to resolv?

CACHES = {
    'default': {
        'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
        'LOCATION': '127.0.0.1:11211',
    },
    'locmem': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
    },
}
COMPRESS_CACHE_BACKEND = 'locmem'

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

already done, but always reports the same error:

2019-04-24 12:49:06,210 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:CUR_TOPINFO): Broken pipe
Traceback (most recent call last):
  File "/home/cloudhome/.local/lib/python2.7/site-packages/django_pylibmc/memcached.py", line 130, in get
    return super(PyLibMCCache, self).get(key, default, version)
  File "/home/cloudhome/cloud/seafile/seafile-server-6.2.5/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
2019-04-24 12:49:06,211 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:CUR_TOPINFO): Broken pipe
Traceback (most recent call last):
  File "/home/cloudhome/.local/lib/python2.7/site-packages/django_pylibmc/memcached.py", line 130, in get
    return super(PyLibMCCache, self).get(key, default, version)
  File "/home/cloudhome/cloud/seafile/seafile-server-6.2.5/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
2019-04-24 12:49:06,242 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:CUR_TOPINFO): Broken pipe
Traceback (most recent call last):
  File "/home/cloudhome/.local/lib/python2.7/site-packages/django_pylibmc/memcached.py", line 130, in get
    return super(PyLibMCCache, self).get(key, default, version)
  File "/home/cloudhome/cloud/seafile/seafile-server-6.2.5/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
2019-04-24 12:49:06,254 [ERROR] django.pylibmc:132 get MemcachedError: error 26 from memcached_get(:1:CUR_TOPINFO): Broken pipe
Traceback (most recent call last):
  File "/home/cloudhome/.local/lib/python2.7/site-packages/django_pylibmc/memcached.py", line 130, in get
    return super(PyLibMCCache, self).get(key, default, version)
  File "/home/cloudhome/cloud/seafile/seafile-server-6.2.5/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

try this

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

This way it works, but I see that unfortunately memcached is not working properly. In the sense that it does not save in the ram-cache the data coming from seahub as it should … Why?

can someone answer me?

I think I’ve seen the same issue with that config. How are you testing it?

Do you see errors in the logs?

-Thanks

Unfortunately yes … If I insert this in the configuration file:

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

it doesn’t work … so I reinserted the options I had before and everything started working … but with errors! And nobody knows how to answer …

Is this an Ubuntu server?

Debian 9

Frankly I was beginning to think the only systems it did work on were Debian systems. In any case you have nothing to lose. Try this:

 sudo apt install memcached python-memcache

 sudo service memcached restart

Check /etc/memcached.conf. You might want to add the IP address of the server to the -l line, like so,

-l 127.0.0.1,{your_server_IP_address}

Stop and restart Seafile before and after installation of the above. I think the third configuration will work (fingers crossed…).

Let me know what you see. We really need to figure out what’s missing from the installation docs. There are far too many posts on this issue.

-Thanks!

then … I tried all the ways but the error persists. I tried also with the configuration proposed by Cisco but nothing … the error persists and not only … I noticed that in this way memcached does not “come into operation”. Place a memcached screenshots with the configuration suggested by cisco:

Screenshot%202019-05-01%2016%3A26%3A22

if instead I remove the cisco configuration I put the first one (the one that is also on the seafile site), that is:

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

this is the result of memcached:

everything works … but log errors persist. Around I read that many have opted for the Cisco configuration … and in fact it is true … errors in the logs no longer appear … but this because memcached, in this way and with those configurations, is not “called” by seahub … so memcached does not enter “in game”! :slight_smile:
I also see that the django version of seahub is a bit old! So this makes me deduce that seahub is almost never updated … partly it’s true! Furthermore, as we can see from the logs, the error also comes mainly from here:

File "/home/cloudhome/cloud/seafile/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/cache/backends/memcached.py", line 84, in get
    val = self._cache.get(key)

so … isn’t that the problem comes from the obsolete version of django?
Because if it is so, obviously the version of django present in the server does not recognize some “new” features that have the packages installed and also recommended by the seafile site. So I hope you seriously consider what has just been said!

… and sorry for my English! :slight_smile:

1 Like

Also right now I uninstalled the “python-memcache” package and tried to restart seafile. Everything continues to work, but there are always errors in the logs. This suggests that however it does not depend on “python-memcache” but on some package contained in the seafile server (django for example).

1 Like

I see your point and cannot disagree with what you’re saying. It’s a mess!

This problem with memcached has been around for a long time. I really don’t think there is a well-defined approach laid out yet. We need some considered input from Development in order to settle it (and certainly more so as we move to a new release of server). Maybe @daniel.pan or @Jonathan can offer a few words of advice here?

2 Likes

We will check the problem.

1 Like

Let’s hope. Also because I noticed that this problem has been present for a long time … but it has not yet been solved … and I have read that in any case there were people who would have said to fix this situation … but none yet the did!

In reality there would be many things (in my opinion) to fix, and if you want I can also tell you (as a common user) what I absolutely didn’t like …

I suggest you upgrade the seafile to 6.3.4 and configure seahub_settings.py according to the manual (https://manual.seafile.com/deploy/add_memcached.html), which means you should use IP:PORT not a sock file. Of course, this will require your memcached service to listen on a valid port.

Already done … I have tried many times and in many ways but the errors persist.

Do you have new error logs? In your previous post, the log message is for v6.2.5.