Seafile 13 Docker Compose intermittently shows “Page unavailable” / fails to connect to DB

Hi again ;),

I am running Seafile 13 with Docker Compose using these services:

  • seafile
  • db (MariaDB)
  • redis
  • notification-server
  • seadoc
  • md-server

Problem

From time to time, the web UI becomes extremely slow and then shows errors like:

  • “Page unavailable”
  • “Sorry, but the requested page is unavailable due to a server hiccup…”

At the same time, md-server logs show messages such as:

  • ERROR 2002 (HY000): Can't connect to server on 'seafile.mysql' (115)
  • WARNING Database initialization failed on attempt 1

Sometimes it recovers on its own after a few retries. However, if it remains in this problematic state, it does not recover by itself later even when the DB should already be ready. In those cases, I have to restart the containers manually.

Frequency

This only happens occasionally, maybe once every 2-3 months.
The same issue already occurred with Seafile v12, so it does not seem to be new in v13.

Workaround

What works for me is the following manual recovery sequence:

  1. Stop all containers manually
  2. Start only the database container first
  3. Wait a bit until MariaDB is fully ready
  4. Start the remaining containers

After that, everything works normally again.

A full recreate also works:

docker compose down
docker compose pull
docker compose up -d --force-recreate

My assumption

My guess is that this may be a startup or readiness issue:

  • depends_on only controls container start order, not actual service readiness
  • md-server may try to connect before MySQL/MariaDB is fully accepting connections
  • if startup enters this bad state, it seems not to recover automatically later even after the DB is ready
  • once the services are started again with the DB already ready, the stack works normally

Questions

Could you please confirm:

  • Is there a recommended way to make sure md-server and seafile waits until the DB is actually ready?
  • Is this a known issue startup timing or DB retry behavior?
  • Is there any official healthcheck or wait-for-db approach recommended for Seafile Docker Compose deployments?

Thanks a lot.

Thanks for reporting the issue. We will check the problem soon.