Memory leak in Seafile causing seaf-server to exhaust system RAM and crash

Hello,

We are observing a continuous and gradual increase in memory usage by the Seafile process (seaf-server) over time. This memory usage grows steadily and eventually consumes nearly 100% of the available RAM on the system, causing the service to crash or become unresponsive.

This behavior persists without any release of allocated memory, even during idle periods. It strongly suggests a memory leak within the application or one of its dependencies.

Steps to Reproduce

  1. Run seaf-server under a typical production workload with active sync and file operations.
  2. Monitor memory usage over several hours or days.
  3. Observe gradual memory consumption increase.
  4. Eventually, the process consumes almost all system memory and crashes.

Observations

  • Monitoring performed using memleak-bpfcc and top shows persistent outstanding allocations, primarily in:
    • libjansson.so.4
    • libglib-2.0.so.0
    • libmariadb.so.3
  • Example from memleak-bpfcc:
1180830 bytes in 57834 allocations from stack
    g_malloc+0xe [libglib-2.0.so.0]
664800 bytes in 20775 allocations from stack
    [unknown] [libjansson.so.4]
  • No evidence of memory being freed over time, especially from repeated JSON operations (json_object, json_integer).
  • Service crashes or becomes non-responsive once memory usage reaches system limits.

Environment

  • Seafile Server Version: 10.0.1
  • Operating System: Ubuntu 22.04.5 LTS
  • Kernel Version: 5.15.0-139-generic
  • Database: 10.6.22-MariaDB-0ubuntu0.22.04.1
  • Filesystem: ext4
  • RAM: 32 Go
  • Deployment Mode: systemd service

Debugging Tools Used

  • memleak-bpfcc from BCC tools
  • top / htop
  • Grafana and a script to supervise the progression of RAM using

Additional Notes

  • The hard disk used to store the data is HDD
  • The issue appears to be related to how Seafile uses libjansson (JSON parsing) and possibly glib.
  • If debug symbols or trace logs would be helpful, we are happy to provide them.
  • We are planning to update the Seafile version to 12.0.11. In the meantime, we need to know if the issue is more related to something else.

If you need more information regarding the issue or the environment used, please do not hesitate to ask me.

Thank you in advance !

Hello @hassan-jroundi ,

The version 10.0 has some known memory leak issues, which should have been fixed in version 12.0. You can try upgrading to version 12.0 and then check if the memory leak issue still persists.

1 Like