[go: up one dir, main page]

Slow/hangs at startup when recently used files are on slow/inaccessible remote filesystem

Problem

  • Given
    • The user has recently accessed files on some network drive / USB drive / remote filesystem
    • The user closes Inkscape
    • Then the drive becomes unavailable (e.g., user unplugs the USB or network cable)
    • Then the user opens Inkscape
  • Then Inkscape takes very long to startup ("hangs" for 30 seconds up to 10 minutes)

Related issue in GIMP: https://gitlab.gnome.org/GNOME/gimp/-/issues/8279

How to reproduce on Windows: Have a recent files entry from a network drive, where the host is now no longer reachable. Start Inkscape. See See #2350 (comment 1806195310)

How to reproduce on Linux:

  • Open Inkscape and open some file so that the recently used files list is not empty.
  • Close Inkscape.
  • Set up a filesystem where ls takes very long, e.g.,
    • Set up broken afuse mount that always hangs, see below.
    • Or: sshfs with afuse, then stop the remote sshd
    • Or: Set up systemd automount of USB drive, then unplug the USB drive
  • Edit ~/.local/share/recently-used.xbel so that the path of the recently opened SVG file points to the "hanging" filesystem
  • Start Inkscape.
  • Starting Inkscape will then take very long or even forever.

To set up the a fake "hanging filesystem":

sudo apt install afuse
mkdir -p ~/temp/hang
afuse -o mount_template="sleep 10" -o unmount_template="true" ~/temp/hang

Now all subdirectories of this new hanging filesystem will take very long to access:

u@u-1-2:~$ time ls ~/temp/hang/hallo/

real	1m43,089s

Root cause for Windows: See #2350 (closed)

Root cause for Linux:

(This is https://twitter.com/gregoa_/status/1320381909361430529 put into the proper place.)

Some days ago, inkscape would hang on startup for me. With strace I found that it

  • opened ~/.local/share/recently-used.xbel (gtk's recently used list)
  • tried to stat() every file it found there
  • failed on a JPEG I had edited in gimp or geeqie or something else some days ago
  • because the file was on a remote filesystem, mounted via sshfs with afuse
  • so afuse tried to automount the file on each inkscape start, but the remote filesystem was not available

I understand that inkscape tries to offer recently opened SVGs in the menu, and it can't "see" from the file path that a directory is not local … Maybe trying to stat() only files previously opened by inkscape and/or only SVGs would at least mitigate the problem a bit.

This is the inkscape package 1.0.1-1 in Debian/unstable.

Edited by Max Gaukler