trackma icon indicating copy to clipboard operation
trackma copied to clipboard

inotify tracking does not work through SSHFS

Open FichteFoll opened this issue 5 years ago • 13 comments

The tracker used to work, but it doesn't anymore. I think since the last update, which was on 2018-09-26, where I updated 0.7.6.r3.g7954a73-1 -> 0.7.6.r8.gb9e26e1-1 (so after 7954a73, probably), and it also doesn't work with current master.

I don't receive any mentions of the tracker finding something, despite even using trackma to play the next episode. My player is mpv and my config is as follows:

{
    "auto_date_change": true,
    "auto_status_change": true,
    "auto_status_change_if_scored": true,
    "autoretrieve": "days",
    "autoretrieve_days": 3,
    "autosend": "minutes",
    "autosend_at_exit": true,
    "autosend_minutes": 5,
    "autosend_size": 5,
    "debug_disable_lock": true,
    "library_autoscan": true,
    "player": "mpv",
    "plex_host": "localhost",
    "plex_obey_update_wait_s": false,
    "plex_passwd": "",
    "plex_port": "32400",
    "plex_user": "",
    "plex_uuid": "e3c03de6-f418-11e7-810e-00133b0f1f1e",
    "scan_whole_list": false,
    "searchdir": "/data/Video/Anime",
    "tracker_enabled": true,
    "tracker_interval": 10,
    "tracker_not_found_prompt": false,
    "tracker_process": "mpv",
    "tracker_type": "local",
    "tracker_update_close": false,
    "tracker_update_prompt": false,
    "tracker_update_wait_s": 540.0
}

FichteFoll avatar Nov 09 '18 22:11 FichteFoll

Coincidentally I discovered that the tracker does work when I play episodes from a different location, i.e. my local hard drive. When I play them from a symlinked folder that is an sshfs mount (symlink because you can only set one media folder), it doesn't work.

Not sure if the symlink is really the problem here, but at least the library scanner works with them, which would be the first thing I expect to break.

FichteFoll avatar Nov 10 '18 23:11 FichteFoll

Thanks for the report. Are you using the inotify or polling tracker? (This should appear in the log/status bar) From what I remember, symlinks don't seem to be working with inotify. The library scanner uses a different method to traverse the directories, which would explain why it works.

z411 avatar Dec 26 '18 08:12 z411

I'm quite confident I'm using inotify. I also seem to remember that notifications don't work with symlinks, but maybe you could add listens for each symlink discovered while crawling through the library? Or do this kind of crawl manually on start because people might have media scanning disabled. Or maybe it works with polling as well. I should try that.

Either way, this would also be solved by #179 as currently I have to edit the config to cycle between three different directories depending on where I stored my media (yes, I have multiple locations).

FichteFoll avatar Dec 27 '18 13:12 FichteFoll

@FichteFoll I've implemented multiple directories in the develop branch, please check if it works for you.

That said, I'll still debug symlinks. I haven't done any conscious change that would stop the library from traversing symlinks (pyinotify).

z411 avatar Apr 05 '19 11:04 z411

I just now looked into this, my bad. Effectively FUSE filesystems like SSHFS don't support inotify so it's expected that the inotify tracker wouldn't work. The library scanner uses regular directory scanning so it works. I'm afraid the inotify tracker wouldn't work even if you used the new multiple directories feature over your SFTP connection.

You could try to force the use of the polling tracker by specifying polling as the tracker_type in your config.json.

z411 avatar Apr 07 '19 06:04 z411

Thanks for investigating. I'll make a menta note to confirm this as soon as get to it.

FichteFoll avatar Apr 07 '19 16:04 FichteFoll

FWIW my library has always been on a sshfs mount and inotify has worked on it. It definitely uses inotify as I had to increase the maximum number of watches to use certain other programs with trackma running. I was not using symlinks though!

Birdulon avatar Apr 08 '19 00:04 Birdulon

Oh really, I should recheck it then. inotify will definitely not work remotely but if it works for you then it is generating inotify events if it occurs locally. I'll try with an SSH mount myself.

z411 avatar Apr 08 '19 03:04 z411

Yeah, it receives local events (e.g. me watching episodes or creating/copying/moving folders around on the mount) but not remote ones (moving folders around via the remote torrent client, new series folders being created by flexget etc.).

Birdulon avatar Apr 08 '19 04:04 Birdulon

I also believe that this did work fine for me before as I was always using inotify and manually edited my media directory setting before launching trackma due to #179. (Still wasn't able to actually confirm this.)

FichteFoll avatar Apr 09 '19 13:04 FichteFoll

@FichteFoll Last question, does the issue occur with pyinotify or inotify? (They're different trackers actually, it should say which one it's using in the terminal when it starts)

z411 avatar Apr 09 '19 19:04 z411

I am indeed using pyinotify. I can try to experiment a bit, but I'll be out of town for a while and won't have time for this for a few weeks.

FichteFoll avatar Apr 11 '19 21:04 FichteFoll

pyinotify doesn't work through symlinks, it took me until reading the source for trackma and pyinotify to figure out why trackma wouldn't work for me. I think this, along with how the different trackers work (ie. the inotify trackers only work for files played under the selected media directory) should be documented somewhere. I'm not sure if this remote issue is related to pyinotify's limitations on symlinks, but I thought I should mention this here.

amhndu avatar Oct 25 '19 08:10 amhndu