Page 1 of 1

Incomplete file when using SFTP

PostPosted: Sun Aug 21, 2022 5:49 pm
by lazytyper
Hi,

I noticed intermittently an issue where files are reporting as incomplete (file size reporting much smaller than system file size).

This means only part of the media can be watched.

To resolve I need to restart the Serviio process.

I found out this only occurs when I use SFTP to upload media to the serving system directly to the directory. Normally I use rsync which changes the filename once the full media file has transferred.

It seems that Serviio detects the new file partway through the transfer, but does not update the library when the transfer has completed.

  Code:
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"


Mounted at /dev/md127 on /mnt/media type xfs (rw,nosuid,nodev,relatime,attr2,inode64,logbufs=8,logbsize=32k,sunit=1024,swidth=2048,noquota,x-gvfs-show)

5.4.0-96-generic #109-Ubuntu SMP Wed Jan 12 16:49:16 UTC 2022 x86_64 x86_64

Serviio version 2.2.1

Re: Incomplete file when using SFTP

PostPosted: Thu Aug 25, 2022 3:56 pm
by cmakula
If you go into the console in the Shared Folder page (under Library) after the SFTP transfer is completed and hit the button for "Force Refresh", it should rescan the library and start working properly.

At least it does in my case...

Re: Incomplete file when using SFTP

PostPosted: Fri Aug 26, 2022 5:47 pm
by lazytyper
Yeah I usually just restart, but force refreshing does this also.

But this means I need to get to my PC to log in and run the command. Was hoping the library would refresh when the transfer completes.

Re: Incomplete file when using SFTP

PostPosted: Mon Aug 29, 2022 8:25 pm
by cmakula
I put a shortcut icon on my cell phone for the console page. Takes me about 15 seconds to hit the button. Is usually fixed about 10-20 seconds after that.

Better than having to boot a PC each time.

I should also mention that you could also crontab a stop and start for the service for a time (like 4AM if you are not usually watching anything at that time of the day) and restart the serviio process daily. If you don't usually watch the media the same day it gets uploaded to the SFTP, it will be up to date by the time you go to play the media following day.

To give you an idea, my crontab looks like this (my setup is a little different, because I load up serviio via an rc.local script after script mounting my network shares): If you have serviio starting as a standard service, you may be able to use a single line/command (systemctl restart serviio.service). This crontab unloads serviio at 4AM every Wednesday morning, and starts it back up at 4:02AM. It also backs up my ramdisk image, empties the disk cache, and reboots the server on the 12th of each month, in case you were wondering what the other lines were.

# m h dom mon dow command

0 5 * * * rsync -arog /opt/ /optbackup/
2 5 * * * sync; echo 3 > /proc/sys/vm/drop_caches
0 3 12 * * /usr/sbin/reboot
0 4 * * 3 /opt/serviio/bin/serviio.sh -stop
2 4 * * 3 /opt/serviio/bin/serviio.sh