Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seafile Drive Client removes account when server temporarily unavailable #2822

Open
phiradd opened this issue Sep 9, 2024 · 5 comments
Open

Comments

@phiradd
Copy link

phiradd commented Sep 9, 2024

I have got a seafile server running in a docker container on a QNAP NAS with the default configuration files (I have not changed any settings yet). It works very well but I have an issue whenever the NAS is not reachable, the account is removed from Seafile Drive Client 3.0.10 on Windows 10, so that I have to relogin and put in all data for that. That is really annyoing. (It is only available in my local network).

Is there any way not to remove the account and just reconnect on server availability? I could not find anything in the configs.

I have changed some sensitive pw/paths in the logs/docker-compose. Please let me know if you need any other logs/config/info.

Thank you for your help!

seadrive-gui.log

[09/09/24 01:07:29] request failed for http://XXX.XXX.XXX.XXX:XXXX/api2/auth/ping/: {"detail":"User inactive or deleted"}

[09/09/24 01:07:29] Deleted account http://XXX.XXX.XXX.XXX:XXXX [email protected] ce8e1d1

docker-compose.yml

services:
  db:
    image: mariadb:10.11
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=XXX # Required, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
      - MARIADB_AUTO_UPGRADE=1
    volumes:
      - /share/Container/container-station-data/application/seafile/seafile-mysql:/var/lib/mysql  # Required, specifies the path to MySQL data persistent store.
    networks:
      - seafile-net

  memcached:
    image: memcached:1.6.18
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net

  seafile:
    image: seafileltd/seafile-mc:11.0-latest
    container_name: seafile
    ports:
      - "9998:8080"
      - "9999:80"
    volumes:
      - /share/Container/container-station-data/application/seafile/seafile-data:/shared   # Required, specifies the path to Seafile data persistent store.
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=XXX # Required, the value should be root's password of MySQL service.
      - TIME_ZONE=Europe/Berlin  # Optional, default is UTC. Should be uncomment and set to your local time zone.
      - [email protected] # Specifies Seafile admin user, default is '[email protected]'.
      - SEAFILE_ADMIN_PASSWORD=XXX# Specifies Seafile admin password, default is 'asecret'.
      - SEAFILE_SERVER_LETSENCRYPT=false   # Whether to use https or not.
      - SEAFILE_SERVER_HOSTNAME=docs.seafile.com # Specifies your host name if https is enabled.
    depends_on:
      - db
      - memcached
    networks:
      - seafile-net

networks:
  seafile-net:

@feiniks
Copy link
Contributor

feiniks commented Sep 10, 2024

Hello @phiradd , can you show the seahub.log and seafile.log from the seafile server when the account was deleted?

@phiradd
Copy link
Author

phiradd commented Sep 11, 2024

@feiniks Sure. Here are the log entry snippets around that time. Thanks for your help.

Seahub.log

2024-09-09 01:07:21,904 [WARNING] django.request:241 log_response Unauthorized: /api2/auth/ping/
2024-09-09 01:07:38,422 [ERROR] django.request:241 log_response Internal Server Error: /api2/account/info/
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/seafile/seafile-server-11.0.12/seahub/seahub/api2/base.py", line 23, in dispatch
    response = super(APIView, self).dispatch(*a, **kw)
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/opt/seafile/seafile-server-11.0.12/seahub/seahub/api2/base.py", line 20, in handle_exception
    return super(APIView, self).handle_exception(exc)
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/rest_framework/views.py", line 497, in dispatch
    self.initial(request, *args, **kwargs)
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/rest_framework/views.py", line 414, in initial
    self.perform_authentication(request)
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/rest_framework/views.py", line 324, in perform_authentication
    request.user
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/rest_framework/request.py", line 227, in user
    self._authenticate()
  File "/opt/seafile/seafile-server-11.0.12/seahub/thirdpart/rest_framework/request.py", line 380, in _authenticate
    user_auth_tuple = authenticator.authenticate(self)
  File "/opt/seafile/seafile-server-11.0.12/seahub/seahub/api2/authentication.py", line 67, in authenticate
    ret = self.authenticate_v2(request, key)
  File "/opt/seafile/seafile-server-11.0.12/seahub/seahub/api2/authentication.py", line 103, in authenticate_v2
    user = User.objects.get(email=token.user)
  File "/opt/seafile/seafile-server-11.0.12/seahub/seahub/base/accounts.py", line 280, in get
    emailuser = ccnet_threaded_rpc.get_emailuser(email)
  File "/opt/seafile/seafile-server-11.0.12/seafile/lib/python3/site-packages/pysearpc/client.py", line 125, in newfunc
    ret_str = self.call_remote_func_sync(fcall_str)
  File "/opt/seafile/seafile-server-11.0.12/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 98, in call_remote_func_sync
    ret_str = transport.send(self.service_name, fcall_str)
  File "/opt/seafile/seafile-server-11.0.12/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 62, in send
    resp_header = recvall(self.pipe, 4)
  File "/opt/seafile/seafile-server-11.0.12/seafile/lib/python3/site-packages/pysearpc/utils.py", line 17, in recvall
    raise NetworkError("Failed to read from socket")
pysearpc.errors.NetworkError: Failed to read from socket

seafile.log

2024-09-09 01:06:22 ../common/seaf-db.c(867): Failed to connect to MySQL: Unknown server host 'db' (-3)
2024-09-09 01:06:23 http-server.c(2714): DB error when get accessible repo list.
2024-09-09 01:06:35 ../common/seaf-db.c(867): Failed to connect to MySQL: Lost connection to server at 'handshake: reading initial communication packet', system error: 110
2024-09-09 01:07:00 ../common/seaf-db.c(867): Failed to connect to MySQL: Lost connection to server at 'handshake: reading initial communication packet', system error: 110
2024-09-09 01:07:01 http-server.c(2714): DB error when get accessible repo list.
2024-09-09 01:07:12 ../common/seaf-db.c(867): Failed to connect to MySQL: Lost connection to server at 'reading authorization packet', system error: 110
2024-09-09 01:07:12 ../common/seaf-db.c(867): Failed to connect to MySQL: Lost connection to server at 'reading authorization packet', system error: 110
2024-09-09 01:07:13 repo-mgr.c(3810): Failed to add branch.
2024-09-09 01:07:13 http-server.c(2714): DB error when get accessible repo list.
2024-09-09 01:07:15 seafile-session.c(631): Failed to create system default repo.
2024-09-09 01:07:15 start to serve on pipe client
2024-09-09 01:07:15 start to serve on pipe client
2024-09-09 01:07:19 ../common/seaf-db.c(867): Failed to connect to MySQL: Lost connection to server at 'handshake: reading initial communication packet', system error: 110
2024-09-09 01:07:20 ../common/seaf-db.c(867): Failed to connect to MySQL: Lost connection to server at 'handshake: reading initial communication packet', system error: 110
2024-09-09 01:07:21 ../common/seaf-db.c(867): Failed to connect to MySQL: Lost connection to server at 'handshake: reading initial communication packet', system error: 110
2024-09-09 01:07:35 ../common/seaf-db.c(928): Failed to prepare sql SELECT e.id, e.email, is_staff, is_active, ctime, passwd, reference_id, role  FROM EmailUser e LEFT JOIN UserRole ON e.email = UserRole.email  WHERE e.email=?: Lost connection to server during query
2024-09-09 01:07:37 ../common/seaf-db.c(501): The mysql connection has expired, creating a new connection to re-query.
2024-09-09 01:10:47 seafile-session.c(65): fileserver: web_token_expire_time = 3600
2024-09-09 01:10:47 seafile-session.c(65): fileserver: web_token_expire_time = 3600
2024-09-09 01:10:48 seafile-session.c(77): fileserver: max_index_processing_threads= 3
2024-09-09 01:10:48 seafile-session.c(77): fileserver: max_index_processing_threads= 3

@feiniks
Copy link
Contributor

feiniks commented Sep 12, 2024

Hello @phiradd , based on the logs, it seems this error occurred due to a database disconnection. Since the database could not be reached, the system was unable to verify the user's existence, resulting in a 401 response. The failure to connect to the database was likely caused by the NAS being unreachable, preventing MySQL from reading the local data. However, a 401 response may not be appropriate in this case, and we will look into optimizing this issue.

@phiradd
Copy link
Author

phiradd commented Sep 12, 2024

@feiniks Thank you very much for your insights. The db runs on the same NAS as the seafile server. Admittedly, there is probably too much running on the NAS, such that the db did not respond in time for the request as the NAS was busy with other stuff. I will upgrade the NAS eventually. Is there a config where I can increase the timeout for the database connection to make it more likely that this issue does not come up that often?

@feiniks
Copy link
Contributor

feiniks commented Sep 13, 2024

Hello @phiradd, the client timeout for MySQL is set to the default and cannot be configured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants