Constant CPU usage ~20% when IDLE

For all containers running on my infra, seafile are the top usage when IDLE, the users are only me and my wife and this is my usage for the stack:

My log after a redeploy:

*** Running /etc/my_init.d/01_create_data_links.sh...
*** Booting runit daemon...
*** Runit started as PID 16
*** Running /scripts/enterpoint.sh...
2026-01-18 18:28:50 Waiting Nginx 
nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored
2026-01-18 18:28:50 Nginx ready 
2026-01-18 18:28:50 This is an idle script (infinite loop) to keep container running. 
nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored
[2026-01-18 18:28:51] Skip running setup-seafile-mysql.py because there is existing seafile-data folder.
[01/18/2026 18:28:51][upgrade]: The container was recreated, start fix the media symlinks
mv: not replacing '/shared/seafile/seahub-data/avatars/default-non-register.jpg'
mv: not replacing '/shared/seafile/seahub-data/avatars/default.png'
mv: not replacing '/shared/seafile/seahub-data/avatars/groups'
[01/18/2026 18:28:51][upgrade]: Done
Starting seafile server, please wait ...
[seaf-server] [2026-01-18 18:28:51] [INFO] seafile-session.c(75): fileserver: web_token_expire_time = 3600
[seaf-server] [2026-01-18 18:28:51] [INFO] seafile-session.c(87): fileserver: max_index_processing_threads= 3
[seaf-server] [2026-01-18 18:28:51] [INFO] seafile-session.c(100): fileserver: fixed_block_size = 8388608
[seaf-server] [2026-01-18 18:28:51] [INFO] seafile-session.c(112): fileserver: max_indexing_threads = 1
[seaf-server] [2026-01-18 18:28:51] [INFO] seafile-session.c(125): fileserver: max_upload_size = -1
[seaf-server] [2026-01-18 18:28:51] [INFO] seafile-session.c(140): fileserver: put_head_commit_request_timeout = 10
[seaf-server] [2026-01-18 18:28:51] [INFO] seafile-session.c(152): fileserver: skip_block_hash = 0
[seaf-server] [2026-01-18 18:28:51] [INFO] ../common/seaf-utils.c(572): Use database Mysql
[seaf-server] [2026-01-18 18:28:51] [INFO] http-server.c(243): fileserver: worker_threads = 10
[seaf-server] [2026-01-18 18:28:51] [INFO] http-server.c(256): fileserver: backlog = 32
[seaf-server] [2026-01-18 18:28:51] [INFO] http-server.c(267): fileserver: verify_client_blocks = 1
[seaf-server] [2026-01-18 18:28:51] [INFO] http-server.c(289): fileserver: cluster_shared_temp_file_mode = 600
[seaf-server] [2026-01-18 18:28:51] [INFO] http-server.c(336): fileserver: check_virus_on_web_upload = 0
[seaf-server] [2026-01-18 18:28:51] [INFO] http-server.c(362): fileserver: enable_async_indexing = 0
[seaf-server] [2026-01-18 18:28:51] [INFO] http-server.c(374): fileserver: async_indexing_threshold = 700
[seaf-server] [2026-01-18 18:28:51] [INFO] http-server.c(386): fileserver: fs_id_list_request_timeout = 300
[seaf-server] [2026-01-18 18:28:51] [INFO] http-server.c(399): fileserver: max_sync_file_count = 100000
[seaf-server] [2026-01-18 18:28:51] [WARNING] ../common/license.c(716): License file /opt/seafile/seafile-license.txt does not exist, allow at most 3 trial users
License file /opt/seafile/seafile-license.txt does not exist, allow at most 3 trial users
[seaf-server] [2026-01-18 18:28:51] [INFO] filelock-mgr.c(1397): Cleaning expired file locks.
[2026-01-18 18:28:53] Start Monitor 
[2026-01-18 18:28:53] Start fileserver 
[fileserver] [2026-01-18 18:28:53] [INFO] use the default log level: info
[fileserver] [2026-01-18 18:28:53] [INFO] Seafile file server started.
Seafile server started
Done.
[2026-01-18 18:28:54] Start seafevents.main 
Starting seahub at port 8000 ...
WARNING:root:Memcached has not been set up
[2026-01-18 18:28:55] Start wsgidav.server.server_cli 
WARNING:root:Memcached has not been set up
Running without configuration file.
[seafdav] [2026-01-18 18:28:56] [INFO] wsgidav.dc.seahub_db:19 Init seahub database...
[seafdav] [2026-01-18 18:28:56] [WARNING] wsgidav.dc.seahub_db:27 Failed to init seahub db: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'.
[seafdav] [2026-01-18 18:28:56] [WARNING] wsgidav.wsgidav_app:271 App wsgidav.mw.cors.Cors(None).is_disabled() returned True: skipping.
[seafdav] [2026-01-18 18:28:56] [INFO] wsgidav.wsgidav_app:280 WsgiDAV/4.3.0 Python/3.12.3 Linux-6.8.0-83-generic-x86_64-with-glibc2.39
[seafdav] [2026-01-18 18:28:56] [INFO] wsgidav.wsgidav_app:294 Lock manager:      LockManager(LockStorageDict)
[seafdav] [2026-01-18 18:28:56] [INFO] wsgidav.wsgidav_app:295 Property manager:  None
[seafdav] [2026-01-18 18:28:56] [INFO] wsgidav.wsgidav_app:296 Domain controller: SeafileDomainController()
[seafdav] [2026-01-18 18:28:56] [INFO] wsgidav.wsgidav_app:306 Registered DAV providers by route:
[seafdav] [2026-01-18 18:28:56] [INFO] wsgidav.wsgidav_app:316   - '/:dir_browser': FilesystemProvider for path '/opt/seafile/seafile-pro-server-13.0.15/seahub/thirdpart/wsgidav/dir_browser/htdocs' (Read-Only)
[seafdav] [2026-01-18 18:28:56] [INFO] wsgidav.wsgidav_app:316   - '/webdav': SeafileProvider for Seafile (Read-Write)
[seafdav] [2026-01-18 18:28:56] [WARNING] wsgidav.wsgidav_app:319 Basic authentication is enabled: It is highly recommended to enable SSL.
[seafdav] [2026-01-18 18:28:56] [INFO] wsgidav:720 Running WsgiDAV/4.3.0 gunicorn/23.0.0 Python 3.12.3 ...
[2026-01-18 18:28:56 +0100] [182] [INFO] Starting gunicorn 23.0.0
[2026-01-18 18:28:56 +0100] [182] [INFO] Listening at: http://0.0.0.0:83 (182)
[2026-01-18 18:28:56 +0100] [182] [INFO] Using worker: gthread
[2026-01-18 18:28:56 +0100] [185] [INFO] Booting worker with pid: 185
INFO:virus_scan:[virus_scan] scan_command option is not found in seafile.conf, disable virus scan.
WARNING:root:Can not start work weixin notice sender: it is not enabled!
WARNING:root:Can not start ldap syncer: it is not enabled!
WARNING:root:Can not start virus scanner: it is not enabled!
WARNING:root:Can not start content scanner: it is not enabled!
WARNING:root:Can not scan repo old files auto del days: it is not enabled!
WARNING:root:Can not start seasearch file index updater: it is not enabled!
WARNING:root:Can not start seasearch wiki index updater: it is not enabled!
Seahub is started
Done.

My docker compose:

services:
  seafile:
    image: seafileltd/seafile-pro-mc:13.0-latest
    container_name: app-drive
    env_file: ../seafile/.env
    deploy:
      resources:
        limits:
          cpus: '2.00'
          memory: 2G
    logging:
      driver: "json-file"
      options:
        mode: "non-blocking"
        max-size: "1m"
        max-file: "3"
    ports:
      - 82:80 
      - 83:83 # webdav
    volumes:
      - /data/docker/seafile/data:/shared
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_started
    networks:
      - seafile
      - seafile-db
    labels:
      wud.watch: false
    restart: unless-stopped

  db:
    image: mariadb:11.4
    container_name: db-mariadb-drive
    command:
      - '--log-warnings=0'
      - '--innodb_use_native_aio=0'
    env_file: ../seafile/.db.env
    deploy:
      resources:
        limits:
          cpus: '2.00'
          memory: 4G
    logging:
      driver: "json-file"
      options:
        mode: "non-blocking"
        max-size: "1m"
        max-file: "3"
    networks:
      - seafile-db
    volumes:
      - /data/docker/seafile/db:/var/lib/mysql
    healthcheck:
      test: [
        "CMD", 
        "healthcheck.sh", 
        "--connect", 
        "--innodb_initialized"
      ]
      start_period: 10s
      interval: 10s
      timeout: 10s
      retries: 100
    labels:
      wud.watch: false
    restart: unless-stopped

  redis:
    image: redis:7
    container_name: db-redis-seafile
    deploy:
      resources:
        limits:
          cpus: '2.00'
          memory: 256M
    logging:
      driver: "json-file"
      options:
        mode: "non-blocking"
        max-size: "1m"
        max-file: "3"
    networks:
      - seafile-db
    volumes:
      - /data/docker/seafile/redis:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 10s
      retries: 10
    labels:
      wud.watch: false
    restart: unless-stopped

networks:
  seafile:
    name: seafile
  seafile-db:
    name: seafile-db

My .env:

TIME_ZONE=Europe/Rome
JWT_PRIVATE_KEY=REDACTED

SITE_ROOT=/
NON_ROOT=false

SEAF_SERVER_STORAGE_TYPE=disk

SEAFILE_LOG_TO_STDOUT=true

ENABLE_SEADOC=false
ENABLE_NOTIFICATION_SERVER=false

## Database
SEAFILE_MYSQL_DB_HOST=db
SEAFILE_MYSQL_DB_USER=REDACTED
SEAFILE_MYSQL_DB_PASSWORD=REDACTED
SEAFILE_MYSQL_DB_CCNET_DB_NAME=ccnet_db
SEAFILE_MYSQL_DB_SEAFILE_DB_NAME=REDACTED
SEAFILE_MYSQL_DB_SEAHUB_DB_NAME=REDACTED

## Scheme
SEAFILE_SERVER_HOSTNAME=REDACTED
SEAFILE_SERVER_PROTOCOL=https

# redis
CACHE_PROVIDER=redis
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=

For instance, this is all docker on the same VM:

3 hours window:

24 hours window:

7 days:

30 days:

There something that I can do to reduce the CPU usage?

1 Like

After a while my log:

WARNING:root:Memcached has not been set up
/opt/seafile/seafile-pro-server-13.0.15/seahub/thirdpart/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
  warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)
/opt/seafile/seafile-pro-server-13.0.15/seahub/seahub/api2/endpoints/internal_api.py:308: SyntaxWarning: invalid escape sequence '\?'
  seadoc_img_url_re =  re.compile("^(.+?)/api/v2.1/seadoc/download-image/([-a-f0-9]{36})/(.+?)(\?|$)", re.IGNORECASE)
/opt/seafile/seafile-pro-server-13.0.15/seahub/seahub/views/file.py:2085: SyntaxWarning: invalid escape sequence '\('
  image_file_name = image_file_name.replace('(', '\(')
/opt/seafile/seafile-pro-server-13.0.15/seahub/seahub/views/file.py:2086: SyntaxWarning: invalid escape sequence '\)'
  image_file_name = image_file_name.replace(')', '\)')
/opt/seafile/seafile-pro-server-13.0.15/seahub/seahub/wiki/utils.py:63: SyntaxWarning: invalid escape sequence '\w'
  return True if re.match('^[\w\s-]+$', name, re.U) else False
/opt/seafile/seafile-pro-server-13.0.15/seahub/seahub/utils/slugify/__init__.py:23: SyntaxWarning: invalid escape sequence '\s'
  new = re.sub('[-\s]+', '-', new)
/opt/seafile/seafile-pro-server-13.0.15/seahub/seahub/api2/endpoints/file_tag.py:226: SyntaxWarning: invalid escape sequence '\.'
  return True if re.match('^[\.\w-]+$', tagname, re.U) else False
/opt/seafile/seafile-pro-server-13.0.15/seahub/seahub/api2/endpoints/revision_tag.py:67: SyntaxWarning: invalid escape sequence '\.'
  return True if re.match('^[\.\w-]+$', tagname, re.U) else False
/opt/seafile/seafile-pro-server-13.0.15/seahub/seahub/wiki2/utils.py:34: SyntaxWarning: invalid escape sequence '\w'
  return True if re.match('^[\w\s-]+$', name, re.U) else False
/opt/seafile/seafile-pro-server-13.0.15/seahub/thirdpart/registration/views.py:22: SyntaxWarning: invalid escape sequence '\*'
  """
/opt/seafile/seafile-pro-server-13.0.15/seahub/seahub/avatar/urls.py:8: SyntaxWarning: invalid escape sequence '\d'
  re_path('^render_primary/(?P<user>[^/]+)/(?P<size>[\d]+)/$', render_primary, name='avatar_render_primary'),
[2026-01-18 18:34:01.252238] Start sending file updates emails...
[2026-01-18 18:34:01.254492] Finish sending file updates emails.
WARNING:root:Memcached has not been set up
/opt/seafile/seafile-pro-server-13.0.15/seahub/thirdpart/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
  warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)
[2026-01-18 18:39:03.817161] Start sending file updates emails...
[2026-01-18 18:39:03.818773] Finish sending file updates emails.
[seaf-server] [2026-01-18 18:43:51] [INFO] filelock-mgr.c(1397): Cleaning expired file locks.
WARNING:root:Memcached has not been set up
/opt/seafile/seafile-pro-server-13.0.15/seahub/thirdpart/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
  warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)
[2026-01-18 18:44:05.962923] Start sending file updates emails...
[2026-01-18 18:44:05.964547] Finish sending file updates emails.

This part repeat every minute:

WARNING:root:Memcached has not been set up
/opt/seafile/seafile-pro-server-13.0.15/seahub/thirdpart/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.

Please refer to the official documentation for deployment instructions. Download and use the latest configuration file.

I’m using seafile pro for years now, I don’t get what u mean by “latest configuration file“ because I only have ENV, which is de recommendation in docs, do u have more detail than a docs link?

EDIT:

I miss the seahub_settings.py with configuration that don’t (have yet!?) some ENV, but no is related to this error (I think so, but I don’t…)

This is my seahub_settings.py

# -*- coding: utf-8 -*-
SECRET_KEY = "b'REDACTED'"
SERVICE_URL = "https://REDACTED/"

COMPRESS_CACHE_BACKEND = 'locmem'
TIME_ZONE = 'Europe/Rome'
FILE_SERVER_ROOT = "https://REDACTED/seafhttp"

ENABLE_WIKI = False
ENABLE_WEBDAV_SECRET = True
ENABLE_SETTINGS_VIA_WEB = True
ENABLE_GLOBAL_ADDRESSBOOK = False
ENABLE_SHARE_TO_ALL_GROUPS = True

# Enable OnlyOffice
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False
ONLYOFFICE_APIJS_URL = 'https://REDACTED/web-apps/apps/api/documents/api.js'
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'vsdx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods', 'pdf')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx', 'pdf')
ONLYOFFICE_JWT_SECRET = REDACTED

# Enable force save to let user can save file when he/she press the save button on OnlyOffice file edit page.
ONLYOFFICE_FORCE_SAVE = True

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'REDACTED'
EMAIL_HOST_PASSWORD = 'REDACTED'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER

CSRF_TRUSTED_ORIGINS = ["https://REDACTED"]
ALLOWED_HOSTS = ['127.0.0.1', 'REDACTED']

ENABLED_ROLE_PERMISSIONS = {
  'default': {
	'can_add_repo': True,
	'can_share_repo': True,
	'can_add_group': True,
	'can_view_org': True,
	'can_add_public_repo': True,
	'can_use_global_address_book': True,
	'can_generate_share_link': True,
        'can_generate_upload_link': True,
	'can_send_share_link_mail': True,
	'can_invite_guest': False,
	'can_drag_drop_folder_to_sync': True,
	'can_connect_with_android_clients': True,
	'can_connect_with_ios_clients': True,
	'can_connect_with_desktop_clients': True,
	'can_export_files_via_mobile_client': True,
	'storage_ids': [],
	'role_quota': '',
	'can_create_wiki': True,
	'can_publish_wiki': True,
	'upload_rate_limit': 0, # unit: kb/s
	'download_rate_limit': 0,
	'monthly_rate_limit': '',
	'monthly_rate_limit_per_user': '',
	'can_choose_office_suite': True,
	'monthly_ai_credit_per_user': -1,
	'can_use_sso_in_multi_tenancy': True,
    },
    'guest': {
	'can_add_repo': False,
	'can_share_repo': False,
	'can_add_group': False,
	'can_view_org': False,
	'can_add_public_repo': False,
	'can_use_global_address_book': False,
	'can_generate_share_link': False,
	'can_generate_upload_link': False,
	'can_send_share_link_mail': False,
	'can_invite_guest': False,
	'can_drag_drop_folder_to_sync': False,
	'can_connect_with_android_clients': False,
	'can_connect_with_ios_clients': False,
	'can_connect_with_desktop_clients': False,
	'can_export_files_via_mobile_client': False,
	'storage_ids': [],
	'role_quota': '',
	'can_create_wiki': False,
	'can_publish_wiki': False,
	'upload_rate_limit': 0,
	'download_rate_limit': 0,
	'monthly_rate_limit': '',
	'monthly_rate_limit_per_user': '',
	'can_choose_office_suite': False,
	'can_use_sso_in_multi_tenancy': False,
    }
}

BTW: Why this is not .env yet? who knows… But I bet this is a dict in python in same way that will works for a dotenv.

Here have a recording of a top inside the container, the root process using cpu is the python3

Recording2026-01-19092408-ezgif.com-video-to-gif-converter

Found the problem, in the seafevents.conf

[INDEX FILES]
external_es_server = true
es_host = REDACTED
es_port = REDACTED
enabled = true
interval = 10m

highlight = fvh
index_office_pdf = true

username = REDACTED
password = REDACTED

[SEAHUB EMAIL]
enabled = true
interval = 30m

[STATISTICS]
enabled=true

The interval was 10s that I switch months ago to migrate some files and don’t rollback to 10m.

Now the server consume only 1%

The error about memcache was the pyc in __pycache__remove the folder and restart the server will generate the seahub_settings.py again.

2 Likes