Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognize hard links as new files #55

Open
codecivet opened this issue Dec 29, 2022 · 5 comments
Open

Recognize hard links as new files #55

codecivet opened this issue Dec 29, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@codecivet
Copy link

I can see that synoindexwatcher is running:

$ ps aux | grep synoindexwat
root      7003  0.0  0.4  14296  2232 ?        S    Dec15   0:21 /bin/python -m synoindexwatcher --config=/usr/local/etc/synoindexwatcher.conf

And the logfile says it is waiting for updates:

2022-12-15 13:28:44,286 INFO Adding watch for path: /volume1/media/Videos
2022-12-15 13:28:52,937 INFO Waiting for media file changes...

But I can confirm that there is a new file in that hierarchy that has not been added to my media index. I'm assuming it searches recursively, right? Any other info that I can use to debug?

@letorbi
Copy link
Owner

letorbi commented Dec 30, 2022

Hej codecivet,

Synoindex Watcher does not automatically add missing files to the media index. Only new files, which have been moved/copied into one of the watched directories (including sub-directories), will be automatically added to the media index.

However, if you want to re-add all files in the watched folders, you could call

$ python -m synoindexwatcher --rebuild-index --config=/usr/local/etc/synoindexwatcher.conf

from the command-line once. This should re-add all existing files to the media index.

If you want more output for debuuging, you can either set the log-level in your config-file to loglevel=DEBUG or append --loglevel=DEBUG to the command line.

Cheers,
Torben

@letorbi letorbi added the question Further information is requested label Dec 30, 2022
@codecivet
Copy link
Author

Thanks for the reply and I should have been more specific that this was a new file that wasn't being detected. I have enabled debugging and added a bunch more debugging statements. My current suspicion is that NFS appears to be triggering (hundreds of?) thousands of MODIFY and CLOSE_WRITE events for large files and those might be overwhelming synoindexwatcher. For now I've tried disabling detection of the MODIFY event, but I'm not sure what repercussions that will have.

@letorbi letorbi self-assigned this Jan 5, 2023
@letorbi letorbi added improvement Make existing code better and removed question Further information is requested labels Jan 5, 2023
@letorbi
Copy link
Owner

letorbi commented Jan 5, 2023

Thanks for the clarification. I will definitely try to look into the issue, but I am quite busy right now, so it might take some time. However, I am always happy about pull request, so feel free to dig deeper into the issue, if you need a fast solution. Sorry that I cannot offer you more right now.

@codecivet
Copy link
Author

I think I figured out the issue, although I am still in the process of confirming:

I was using a program that automatically renames and moves files on the NFS share. By default, it does that by using hard links. I believe something about using hard links caused synoindexwatcher (or perhaps inotify) to miss the files getting moved to their final location, probably since it wasn't really a move operation due to using a hard link.

Fortunately, I was able to disable the hard linking feature of my app and that seems to have resolved my issue. I have now reverted all changes I made to the source to check that everything is still working properly.

I haven't done any research to see if there would be an inotify-compatible method of handling hard links, but I'll close this issue once I have done some more verification.

@letorbi
Copy link
Owner

letorbi commented Jan 12, 2023

Awesome, thanks for your work. I really appreciate it. Please keep the issue open. I'd like to keep it as a reminder that the handling of hard links needs to be fixed.

@letorbi letorbi changed the title synoindexwatcher not catching new files recognize hard links as new files Jan 13, 2023
@letorbi letorbi changed the title recognize hard links as new files Recognize hard links as new files Jan 13, 2023
@letorbi letorbi added bug Something isn't working and removed improvement Make existing code better labels Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants