Bug: Seafile-cli AppImage 9.0.16 spawns persistent processes and leaves FUSE mounts after start/stop cycles

Hi Seafile team,

I’m seeing what looks like a process leak plus leftover AppImage mounts when repeatedly starting/stopping the Seafile-cli AppImage. Processes never terminate and FUSE mount points accumulate under /tmp/.mount_*.


Environment

  • Seafile-cli version: 9.0.16 (AppImage)
  • Architecture: x86_64
  • OS: Linux Debian Trixie

Steps to reproduce

Run repeated start/stop cycles:

$ ./Seafile-cli-x86_64-9.0.16.AppImage start
Starting seafile daemon ...
Started: seafile daemon ...
$ ./Seafile-cli-x86_64-9.0.16.AppImage stop
$ ./Seafile-cli-x86_64-9.0.16.AppImage start
Starting seafile daemon ...
Started: seafile daemon ...
$ ./Seafile-cli-x86_64-9.0.16.AppImage stop
$ ./Seafile-cli-x86_64-9.0.16.AppImage start
Starting seafile daemon ...
Started: seafile daemon ...
$ ./Seafile-cli-x86_64-9.0.16.AppImage stop

Observed behavior

Each cycle leaves behind a persistent AppImage process plus a loop process that never exits:

$ ps aux

        ...
...    3463203  ...   Ssl  16:54   0:00 ./Seafile-cli-x86_64-9.0.16.AppImage start
...    3463228  ...   S    16:54   0:00 bash -c      while true; do         sleep 1     done                
...    3463264  ...   Ssl  16:55   0:00 ./Seafile-cli-x86_64-9.0.16.AppImage start
...    3463286  ...   S    16:55   0:00 bash -c      while true; do         sleep 1     done                
...    3463316  ...   Ssl  16:55   0:00 ./Seafile-cli-x86_64-9.0.16.AppImage start
...    3463334  ...   S    16:55   0:00 bash -c      while true; do         sleep 1     done                
...    3463368  ...   Ssl  16:55   0:00 ./Seafile-cli-x86_64-9.0.16.AppImage start
...    3463386  ...   S    16:55   0:00 bash -c      while true; do         sleep 1     done                
...    3463453  ...   S    16:55   0:00 sleep 1
...    3463454  ...   S    16:55   0:00 sleep 1
...    3463456  ...   S    16:55   0:00 sleep 1
        ... 

Additionally, FUSE mounts accumulate and remain mounted:

$ mount

      ...
/home/.../Seafile-cli-x86_64-9.0.16.AppImage on /tmp/.mount_Seafil4pqIye type fuse.Seafile-cli-x86_64-9.0.16.AppImage (ro,nosuid,nodev,relatime,user_id=...,group_id=...)
/home/.../Seafile-cli-x86_64-9.0.16.AppImage on /tmp/.mount_SeafilpIGwtz type fuse.Seafile-cli-x86_64-9.0.16.AppImage (ro,nosuid,nodev,relatime,user_id=...,group_id=...)
/home/.../Seafile-cli-x86_64-9.0.16.AppImage on /tmp/.mount_SeafiljX0t11 type fuse.Seafile-cli-x86_64-9.0.16.AppImage (ro,nosuid,nodev,relatime,user_id=...,group_id=...)
/home/.../Seafile-cli-x86_64-9.0.16.AppImage on /tmp/.mount_SeafilGuu45L type fuse.Seafile-cli-x86_64-9.0.16.AppImage (ro,nosuid,nodev,relatime,user_id=...,group_id=...)
      ...

Expected behavior

  • stop should terminate all daemon and helper processes.
  • AppImage mounts should be automatically unmounted when the process exits.
  • Repeated start/stop cycles should not accumulate background loops or FUSE mounts.

Happy to provide additional info and suggestions if needed.

Thanks!

Hi,

This issue has been fixed in version 9.0.18.

Thanks for addressing this issue.

The solution in 9.0.18, I notice, modifies the infinite cycle that was present in the AppRun script as follows

if [ "$1" = "start" ]; then
    exec bash -c '
    while true; do
        pgrep -x seaf-daemon > /dev/null || break
        sleep 1
    done
    ' &
fi

This approach sort of works, but it fails if there are many users on the system, each running its own seafile daemon.

I suggest that the proper solution would be to remove the infinite loop entirely, and to change the python script app/seaf-cli in such a way that it behaves as the AppImage runtime expects. This change is trivial: suffices to add the argument close_fds=False to the call subprocess.Popen in run_argv.

The code is just one line, anyway I’m submitting a pull request. This solution has been tested on Debian Trixie.

Hello @vacaboja ,

Thank you, we will consider this solution.