SFTP using cache-based mode instead of FileJob-based
Recently (I suspect since v5.0) I started experiencing long delays when opening a video file via sftp:// url in VLC via kio-fuse. The file starts opening and does not play for tens of seconds to minutes. The larger the file, the longer the delay. This does not happen on smb:// urls.
I have found out, via SFTP kio-fuse downloads the whole file before it starts playing. I have confirmed this by running
killall kio-fuse; export QT_LOGGING_RULES="org.kde.kio.fuse.debug=true;kf5.kio.core.*=true;log_kio_sftp=true;log_kio_sftp.trace=true"; /usr/lib64/libexec/kio-fuse -d
When using SMB, the output contains:
org.kde.kio.fuse: Reading 131072 byte(s) at offset 626688 of (FileJob-based) node "filename-redacted.mp4"
However when using SFTP it contains:
org.kde.kio.fuse: Reading 4096 byte(s) at offset 32768 of (cache-based) node "filename-redacted.mp4"
The --disable-filejob-io
is not set. When I set it, even SMB uses the cache and downloads the whole file before playing.
The filejob/cache mode selection boils down to this condition https://github.com/KDE/kio-fuse/blob/master/kiofusevfs.cpp#L1861 But SFTP should support both opening and truncating.
OS: Gentoo, 5.15.16-gentoo-x86_64 KIO FUSE version 5.0.0 FUSE library version 3.10.5 using FUSE kernel interface version 7.31 fusermount3 version: 3.10.5 kio-extras version: 21.08.3-r1