SOLVED - Memcached problem - Ubuntu16.04

Hi

This is a fresh Seafile install on a fresh install Ubuntu 16.04 Hetzner Server.
Seafile server 6.2.5

Something went wrong with my memcached, which I can see in the sehub.log (see below in this post).
I am not sure about memcached and how to fix it.
So I am posting this, hoping that someone might be able to give me a quick solution, although I probably should do a memcached research…

The problem I have is that seahub.log is full of errors as pasted below and the issue I have is this:

When a user clicks on “sign up” on the Seafile start page, then no Email gets sent and the next webpage page gives and error:

Page unavailable
Sorry, but the requested page is unavailable due to a server hiccup.
Our engineers have been notified, so check back later.

This is the seahub_setting.py:

SECRET_KEY = “xxx”

FILE_SERVER_ROOT = ‘https://cloud2.example.com/seafhttp
CLOUD_MODE = True
ENABLE_GLOBAL_ADDRESSBOOK = False
TIME_ZONE = ‘Europe/Berlin’

SITE_NAME = ‘cloud2.example.com
SITE_TITLE = ‘YNA CLoud’

SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER = False

EMAIL_USE_TLS = True
EMAIL_HOST = ‘mail.example.com’ # smtp server
EMAIL_HOST_USER = ‘admin@example.com’ # username and domain
EMAIL_HOST_PASSWORD = ‘xxx’ # password
EMAIL_PORT = ‘587’
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER

DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: ‘seahub-db’,
‘USER’: ‘seafile’,
‘PASSWORD’: ‘xxx’,
‘HOST’: ‘127.0.0.1’,
‘PORT’: ‘3306’
}
}

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

This is ccnet.conf:

And this is the seahub_django_request.log

2018-03-26 09:47:15,021 [ERROR] django.request:256 handle_uncaught_exception Internal Server Error: /accounts/register/
Traceback (most recent call last):
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/handlers/base.py”, line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/registration/views.py”, line 197, in register
new_user = backend.register(request, **form.cleaned_data)
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/seahub/base/accounts.py”, line 583, in register
send_email=config.REGISTRATION_SEND_MAIL)
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/registration/models.py”, line 93, in create_inactive_user
send_email, is_active=False)
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/registration/models.py”, line 85, in create_email_user
registration_profile.send_activation_email(site)
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/registration/models.py”, line 285, in send_activation_email
ctx_dict, None, [user.username])
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/seahub/utils/init.py”, line 827, in send_html_email
msg.send()
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/mail/message.py”, line 303, in send
return self.get_connection(fail_silently).send_messages([self])
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/mail/backends/smtp.py”, line 100, in send_messages
new_conn_created = self.open()
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/mail/backends/smtp.py”, line 58, in open
self.connection = connection_class(self.host, self.port, **connection_params)
File “/usr/lib/python2.7/smtplib.py”, line 256, in init
(code, msg) = self.connect(host, port)
File “/usr/lib/python2.7/smtplib.py”, line 316, in connect
self.sock = self._get_socket(host, port, self.timeout)
File “/usr/lib/python2.7/smtplib.py”, line 291, in _get_socket
return socket.create_connection((host, port), timeout)
File “/usr/lib/python2.7/socket.py”, line 575, in create_connection
raise err
error: [Errno 111] Connection refused
2018-03-26 09:47:15,255 [WARNING] django.request:170 get_response Not Found: /favicon.ico

And this is Seahub.log:

2018-03-26 09:47:15,271 [ERROR] django.pylibmc:146 set MemcachedError: error 47 from memcached_set: (0x23ae5e0) SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY, host: 127.0.0.1:11211 → libmemcached/connect.cc:720
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/django_pylibmc/memcached.py”, line 140, in set
**COMPRESS_KWARGS)
ServerDown: error 47 from memcached_set: (0x23ae5e0) SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY, host: 127.0.0.1:11211 → libmemcached/connect.cc:720

I found out that there was a problem when installing the pips:

sudo pip install pylibmc
sudo pip install django-pylibmc

Then I received error messages

ck@office:~$ sudo pip install pylibmc
The directory ‘/home/ck/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/home/ck/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Requirement already satisfied: pylibmc in /usr/local/lib/python2.7/dist-packages
ck@office:~$ sudo pip install django-pylibmc
\The directory ‘/home/ck/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/home/ck/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
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)

I solved it by using the flag -H

sudo -H pip install pylibmc
sudo -H pip install django-pylibmc

Then I did not receive the error message

ck@office:~$ sudo -H pip install pylibmc
Requirement already satisfied (use --upgrade to upgrade): pylibmc in /usr/local/lib/python2.7/dist-packages
You are using pip version 8.1.1, however version 9.0.3 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
ck@office:~$ sudo -H pip install django-pylibmc
Requirement already satisfied (use --upgrade to upgrade): django-pylibmc in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): pylibmc>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from django-pylibmc)
You are using pip version 8.1.1, however version 9.0.3 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.

I rebooted the machine but I am still getting error the error message, when someone tries to “sign up” in my seafile:

2018-03-26 16:08:46,462 [ERROR] django.request:256 handle_uncaught_exception Internal Server Error: /accounts/register/
Traceback (most recent call last):
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/handlers/base.py”, line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/registration/views.py”, line 197, in register
new_user = backend.register(request, **form.cleaned_data)
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/seahub/base/accounts.py”, line 583, in register
send_email=config.REGISTRATION_SEND_MAIL)
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/registration/models.py”, line 93, in create_inactive_user
send_email, is_active=False)
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/registration/models.py”, line 85, in create_email_user
registration_profile.send_activation_email(site)
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/registration/models.py”, line 285, in send_activation_email
ctx_dict, None, [user.username])
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/seahub/utils/init.py”, line 827, in send_html_email
msg.send()
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/mail/message.py”, line 303, in send
return self.get_connection(fail_silently).send_messages([self])
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/mail/backends/smtp.py”, line 100, in send_messages
new_conn_created = self.open()
File “/home/ck/seafile.cloud/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/mail/backends/smtp.py”, line 58, in open
self.connection = connection_class(self.host, self.port, **connection_params)
File “/usr/lib/python2.7/smtplib.py”, line 256, in init
(code, msg) = self.connect(host, port)
File “/usr/lib/python2.7/smtplib.py”, line 316, in connect
self.sock = self._get_socket(host, port, self.timeout)
File “/usr/lib/python2.7/smtplib.py”, line 291, in _get_socket
return socket.create_connection((host, port), timeout)
File “/usr/lib/python2.7/socket.py”, line 575, in create_connection
raise err
error: [Errno 111] Connection refused

Still would be grateful for some help :wink:

Chris

That actually looks like an issue with your mail configuration.

Thanks shoeper

Found it out.

When naming the new server, I used the same name as my mail server (mail.example.com).

That’s because step by step I want to move seafile and mail server there.

When seafile tried to connect to my mail server, it actually referenced to its own name.
I found it out when I pinged the mail server from the new server.

so… I changed the server name, Seafile and sign up works great, memcached works (with the pip _H flag), all happy.

And lost some hairs about this :wink:

Hope this helps someone else one day as well.

Always something :wink:

Greetings, Chris