Error 111: ConnectionRefusedError at /accounts/login/

Hello everyone !

(because i can’t add links to my post, i replaced https by hhtps ; sorry for inconvenience)

I installed the seafile server on a remote debian 10 few days back, with nginx and HTTPS support. Other websites on that server are correctly running.
Seafile worked like a charm until yesterday, when i last used it (created some users, libraries, and uploaded a dozen files). But today, i wanted to use the seahub interface so i got to hhtps://cloud.myserver.net/, where i normally get the seahub interface, and when i logged in, i end up on hhtps://cloud.myserver.net/accounts/login/?next=/ with an interactive stack trace beginning with

ConnectionRefusedError at /accounts/login/
[Errno 111] Connection refused

Exception Type: ConnectionRefusedError
Exception Value: [Errno 111] Connection refused
Exception Location: /home/seafile/seafile-server-7.1.4/seafile/lib64/python3.6/site-packages/pysearpc/named_pipe.py in connect, line 47

I tried to login with many username/password, even non-existing ones. All were giving me the same result. I ran chown -R www-data:www-data . in the /home/seafile directory, which is accessible by the same user/group. I did some work on the server during the night, but none on seafile-related repositories. I restarted seafile and seahub properly. I have added some extensions to php7.3, but i doubt it would change a thing.

/home/seafile/conf/seafile.conf:

[fileserver]
host = 0.0.0.0
port=8081

/home/seafile/conf/seahub_settings.py:

DEBUG = True
SECRET_KEY = "..."
FILE_SERVER_ROOT = 'htps://cloud.myserver.net/seafhttp'

/home/seafile/conf/ccnet.conf:

[General]
SERVICE_URL = hhtps://MY.IP.ADDR.ESS:7999
[quota]
default = 2

Exerpt from /var/log/nginx/seahub.error.log:

2020/06/12 16:48:58 [error] 15973#15973: *1 connect() failed (111: Connection refused) while connecting to upstream, client: [IPADDRESS], server: cloud.myserver.net, request: "POST /accounts/login/?next=/ HTTP/2.0", upstream: "http://127.0.0.1:7999/accounts/login/?next=/", host: "cloud.myserver.net", referrer: "hhtps://cloud.myserver.net/accounts/login/?next=/"

Here is the full log downloaded on the buggy page:

Environment:


Request Method: POST
Request URL: hhtps://cloud.myserver.net/accounts/login/?next=/

Django Version: 1.11.29
Python Version: 3.7.3
Installed Applications:
('django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'seahub.base',
 'django.contrib.auth',
 'registration',
 'captcha',
 'statici18n',
 'constance',
 'constance.backends.database',
 'post_office',
 'termsandconditions',
 'webpack_loader',
 'seahub.api2',
 'seahub.avatar',
 'seahub.contacts',
 'seahub.drafts',
 'seahub.institutions',
 'seahub.invitations',
 'seahub.wiki',
 'seahub.group',
 'seahub.notifications',
 'seahub.options',
 'seahub.onlyoffice',
 'seahub.profile',
 'seahub.share',
 'seahub.help',
 'seahub.thumbnail',
 'seahub.password_session',
 'seahub.admin_log',
 'seahub.wopi',
 'seahub.tags',
 'seahub.revision_tag',
 'seahub.two_factor',
 'seahub.role_permissions',
 'seahub.trusted_ip',
 'seahub.repo_tags',
 'seahub.file_tags',
 'seahub.related_files',
 'seahub.work_weixin',
 'seahub.file_participants',
 'seahub.repo_api_tokens',
 'seahub.abuse_reports',
 'gunicorn')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'seahub.auth.middleware.AuthenticationMiddleware',
 'seahub.base.middleware.BaseMiddleware',
 'seahub.base.middleware.InfobarMiddleware',
 'seahub.password_session.middleware.CheckPasswordHash',
 'seahub.base.middleware.ForcePasswdChangeMiddleware',
 'termsandconditions.middleware.TermsAndConditionsRedirectMiddleware',
 'seahub.two_factor.middleware.OTPMiddleware',
 'seahub.two_factor.middleware.ForceTwoFactorAuthMiddleware',
 'seahub.trusted_ip.middleware.LimitIpMiddleware')



Traceback:

File "/home/seafile/seafile-server-7.1.4/seafile/lib64/python3.6/site-packages/pysearpc/named_pipe.py" in _get_transport
  88.             transport = self._pool.get(False)

File "/usr/lib/python3.7/queue.py" in get
  167.                     raise Empty

During handling of the above exception (), another exception occurred:

File "/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/utils/decorators.py" in _wrapped_view
  149.                     response = view_func(request, *args, **kwargs)

File "/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)

File "/home/seafile/seafile-server-7.1.4/seahub/seahub/auth/views.py" in login
  121.         if form.is_valid():

File "/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/forms/forms.py" in is_valid
  183.         return self.is_bound and not self.errors

File "/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/forms/forms.py" in errors
  175.             self.full_clean()

File "/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/forms/forms.py" in full_clean
  385.         self._clean_form()

File "/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/forms/forms.py" in _clean_form
  412.             cleaned_data = self.clean()

File "/home/seafile/seafile-server-7.1.4/seahub/seahub/auth/forms.py" in clean
  55.                                            password=password)

File "/home/seafile/seafile-server-7.1.4/seahub/seahub/auth/__init__.py" in authenticate
  56.             user = backend.authenticate(**credentials)

File "/home/seafile/seafile-server-7.1.4/seahub/seahub/base/accounts.py" in authenticate
  576.         user = self.get_user(username)

File "/home/seafile/seafile-server-7.1.4/seahub/seahub/base/accounts.py" in get_user
  570.             user = self.get_user_with_import(username)

File "/home/seafile/seafile-server-7.1.4/seahub/seahub/base/accounts.py" in get_user_with_import
  541.         emailuser = seaserv.get_emailuser_with_import(username)

File "/home/seafile/seafile-server-7.1.4/seafile/lib64/python3.6/site-packages/seaserv/service.py" in get_emailuser_with_import
  128.     return ccnet_threaded_rpc.get_emailuser_with_import(email)

File "/home/seafile/seafile-server-7.1.4/seafile/lib64/python3.6/site-packages/pysearpc/client.py" in newfunc
  126.             ret_str = self.call_remote_func_sync(fcall_str)

File "/home/seafile/seafile-server-7.1.4/seafile/lib64/python3.6/site-packages/pysearpc/named_pipe.py" in call_remote_func_sync
  100.         transport = self._get_transport()

File "/home/seafile/seafile-server-7.1.4/seafile/lib64/python3.6/site-packages/pysearpc/named_pipe.py" in _get_transport
  90.             transport = self._create_transport()

File "/home/seafile/seafile-server-7.1.4/seafile/lib64/python3.6/site-packages/pysearpc/named_pipe.py" in _create_transport
  83.         transport.connect()

File "/home/seafile/seafile-server-7.1.4/seafile/lib64/python3.6/site-packages/pysearpc/named_pipe.py" in connect
  47.         self.pipe.connect(self.socket_path)

Exception Type: ConnectionRefusedError at /accounts/login/
Exception Value: [Errno 111] Connection refused

Thanks for you time. Any help will be appreciated.

Anyway, thanks for reading and have a good day !

Ok, that was weird.

While browsing processes using htop, i noticed an alive seafile process configured for the very first conf directory i used when i wanted to just give a try to seafile, hours before the real installation.

I killed that process. Dozens others died with it. Restarted seafile. Now it fully works.

I probably did something wrong at some point in the install.

Always take a look at your running processes, folks.

I had the same issue. Stopping and starting seaf-cli worked, however after the device rebooted, I would get connection refused when doing seaf-cli status and even seaf-cli start:

$ seaf-cli status
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pysearpc/named_pipe.py", line 85, in _get_transport
    transport = self._pool.get(False)
  File "/usr/lib/python3.9/queue.py", line 168, in get
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/seaf-cli", line 1023, in <module>
    main()
  File "/usr/bin/seaf-cli", line 1019, in main
    args.func(args)
  File "/usr/bin/seaf-cli", line 779, in seaf_status
    tasks = seafile_rpc.get_clone_tasks()
  File "/usr/lib/python3/dist-packages/pysearpc/client.py", line 125, in newfunc
    ret_str = self.call_remote_func_sync(fcall_str)
  File "/usr/lib/python3/dist-packages/pysearpc/named_pipe.py", line 97, in call_remote_func_sync
    transport = self._get_transport()
  File "/usr/lib/python3/dist-packages/pysearpc/named_pipe.py", line 87, in _get_transport
    transport = self._create_transport()
  File "/usr/lib/python3/dist-packages/pysearpc/named_pipe.py", line 80, in _create_transport
    transport.connect()
  File "/usr/lib/python3/dist-packages/pysearpc/named_pipe.py", line 44, in connect
    self.pipe.connect(self.socket_path)
ConnectionRefusedError: [Errno 111] Connection refused

What I needed to do was get seaf-cli to start at bootup. I would post a link with specific instructions to do so, but apparently the forum admins don’t allow people to post links, even to their own site, so you’re on your own now. Good luck and godspeed!