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

inotify stopped working #2926

Closed
nobanzai opened this issue Dec 20, 2023 · 36 comments
Closed

inotify stopped working #2926

nobanzai opened this issue Dec 20, 2023 · 36 comments

Comments

@nobanzai
Copy link

nobanzai commented Dec 20, 2023

With gerbera 1.12.1 on my openSUSE LEAP 15.5 inotify seems to have stopped working.
Neither the UI nor the log show any action when adding new files to one of the autoscan directories.
They are all configured like this:

<autoscan use-inotify="yes">
...
<directory location="/archiv/music/" media-type="Music" mode="inotify" recursive="yes" hidden-files="no"/>

They are located on a local disk/partition using ext4.

@KarlStraussberger
Copy link
Member

I experienced some strange behaviour on my 15.4 also (I plan to update to 15.5 soon) and updated some code in current development branch.

Anyway, Gerbera 1.5.1 is quite old, so I recommend to update your box (https://build.opensuse.org/package/show/multimedia:apps/gerbera) and see whether the issue still exists.

@nobanzai
Copy link
Author

nobanzai commented Dec 20, 2023

Sorry, I have 1.12.1 installed!
After updating to this version, the problems occurred.

@KarlStraussberger
Copy link
Member

KarlStraussberger commented Dec 21, 2023

Which package did you install? MultiMedia:apps?

Did you try to reinstall after updating to LEAP 15.5?

@nobanzai
Copy link
Author

nobanzai commented Dec 21, 2023

I had installed gerbera before updating to 15.5. And AFAIR the Update to 15.5 also updated gerbera. And there was at least one more update since then.

rpm says:

Name : gerbera
Version : 1.12.1
Release : lp155.36.2
Architecture: x86_64
Install Date: Sun Nov 12 14:46:30 2023
Group : Productivity/Multimedia/Other
Size : 7361471
License : GPL-2.0-only
Signature : RSA/SHA256, Tue Oct 24 01:24:52 2023, Key ID 77ec2301f23c6aa3
Source RPM : gerbera-1.12.1-lp155.36.2.src.rpm
Build Date : Tue Oct 24 01:23:59 2023

And zypper says:

i+ | gerbera | package | 1.12.1-lp155.36.2 | x86_64 | Multimedia - Apps - Leap 15.5

So it is the version from Multimedia:Apps

@KarlStraussberger
Copy link
Member

Can you run gerbera --compile-info

@nobanzai
Copy link
Author

gerbera --compile-info

Gerbera UPnP Server 1.12.1
Copyright 2016-2022 Gerbera Contributors.
Licence GPLv2: GNU GPL version 2.
This is free software: you are free to change and redistribute it.

Compile info

WITH_NPUPNP=NO
WITH_MAGIC=1
WITH_MYSQL=NO
WITH_CURL=YES
WITH_INOTIFY=1
WITH_JS=1
WITH_TAGLIB=1
WITH_AVCODEC=1
WITH_FFMPEGTHUMBNAILER=1
WITH_EXIF=0
WITH_EXIV2=1
WITH_MATROSKA=YES
WITH_WAVPACK=NO
WITH_SYSTEMD=1
WITH_LASTFM=NO
WITH_DEBUG=YES
WITH_DEBUG_OPTIONS=YES
WITH_TESTS=1

@KarlStraussberger
Copy link
Member

I'm on 15.5 now also and don't see an issue with inotify.

I recently fixed an issue when you manually renamed a new folder (on my samba share) and then added something into that folder. Maybe that's your scenario as well.

@nobanzai
Copy link
Author

No, in my scenario I add a new folder with some new songs to one of the autoscan hierarchies. In this case the songs are not added to the database until gerbera is restarted.

@KarlStraussberger
Copy link
Member

That sounds very similar. I did not investigate into all scenarios, but the new files show up again.

@nobanzai
Copy link
Author

But isn't that the normal scenario for autoscan usage? Adding new folders or files, modfying files and so on? In none of those cases the modifications are seen by gerbera.

@KarlStraussberger
Copy link
Member

In my case it was the contents of a new folder. Been broken along the way. Gerbera did not route the changes to the correct target anymore.

@nobanzai
Copy link
Author

Do you know, when your fixes will be available for openSUSE Leap 15.5?
The package in the multimedia repo still is the old one from about a year ago.

@KarlStraussberger
Copy link
Member

I am working on the new gerbera version which hopefully will be picked up by the tumbleweed package maintainer to make it publicly available.

@nobanzai
Copy link
Author

nobanzai commented Jan 2, 2024

I got 1.12.1 from multimedia:apps, but still inotify does not work - neither for modfied nor for new files nor for new directories nor for new or modifed playlists.
Any idea?

@KarlStraussberger
Copy link
Member

The change was made after 1.12.1. So you have to hope for #2944.
Otherwise it's worth another release afterwards

@nobanzai
Copy link
Author

nobanzai commented Jan 3, 2024

Would it be possible to build a 1.12.2 Version including this patch?

@KarlStraussberger
Copy link
Member

There is no way to extract that single patch (if its only one) from the history of more than 100 commits.

@nobanzai
Copy link
Author

nobanzai commented Jan 3, 2024

Uhm, no, I meant, can you build a version with all new commits in the near future - including this patch?

@KarlStraussberger
Copy link
Member

I already started the PR #2944. I am only waiting for one more feedback on #2917 and my local tests after the latest changes.

@jimishol
Copy link

jimishol commented Jan 6, 2024

I am on opensuse tubleweed. After resent update that fixed a crash on start issue, i noticed that some songs in Music folder was not in database. (Anyway I always prefer manual scans than auto ones.) I did not see any option for manually scan folders in web interface (that i would like to have). My only option seemed to be to delete Music folder and add it again so as a new database to be created.
I write this to confirm that neither inotify nor timed scan entering of some folder to database is working.
I tried to enter manually the Music folder path through expert config option of web interface but even if an entry was created and saved, the path record remained empty with some error warning. (If it tried to edit the config in /etc/ as user it would normal to fail but i expected to try to edit the configuration in user's folder.)
My music folder contains no files but only folders and it is actually a link, but following links is enabled.
There is a config xml in /etc/ folder but i actually use a configuration that exist in my /home/user/ directory and in config tab of web interface i see that indeed my home's configuration is used.
It is possible though that my configuration is faulty as it is probably rooted many many years ago to mediatob use before switching to gerbera.

@nobanzai
Copy link
Author

nobanzai commented Jan 6, 2024

Restarting gerbera leads to a database update here.
It is annoying, but works.

@nobanzai
Copy link
Author

I installed

Name : gerbera
Version : 2.0.0
Release : lp155.40.2
Architecture: x86_64
Install Date: Sa 13 Jan 2024 17:40:44 CET
Group : Productivity/Multimedia/Other
Size : 7859356
License : GPL-2.0-only
Signature : RSA/SHA256, Di 09 Jan 2024 02:22:56 CET, Key ID 77ec2301f23c6aa3
Source RPM : gerbera-2.0.0-lp155.40.2.src.rpm
Build Date : Di 09 Jan 2024 02:22:02 CET

today, but the problem remains - inotify doesn't seem to work.

@KarlStraussberger
Copy link
Member

Can you comment out the hardening additions in gerbera.service. They may block inotify. Also, you may add debug-mode="autoscan" in the <server tag to see what happens under the hood.

@nobanzai
Copy link
Author

I commented out the hardening additions and added the debug option, but there is something really strange going on.
The debug output clearly shows, that gerbera gets inotify events, and afterwards the added songs are shown up in the database. But: My import script is never called - at least its output isn't shown in the log.
After removing the debug option, inotify seems to stop working. No new files show up in the database.
For every test I copied a folder with a few songs to one of the autoscan directories, always changed the name of the folder and the tags of the song according to the folder name.

@KarlStraussberger
Copy link
Member

If you want to get output, you need to use print. console.log does not work. You can add |script debug-mode to see the details of the scripting engine

@nobanzai
Copy link
Author

Before installing this version, I got every "print" in gerbera.log. Has this changed?

@KarlStraussberger
Copy link
Member

Sorry, pushed that private change by accident. Thinking about a new function allowing to set mode to info or debug.

@nobanzai
Copy link
Author

nobanzai commented Jan 13, 2024

So what do I have to change in my scripts to get the log back?
And what about: After removing the debug option, inotify seems to stop working, while it seems to work with active debugging?

@KarlStraussberger
Copy link
Member

For the moment you have to keep the debug-mode.

Inotify should not depend on debug. Some hidden cause we have to find out.

In the meantime, I'm working on the print-fix

@nobanzai
Copy link
Author

nobanzai commented Jan 14, 2024

But even in debug mode my print statements don't show up?!?

@KarlStraussberger
Copy link
Member

Then we should focus on the autoscan messages or errors when loading the scripts on startup.

@nobanzai
Copy link
Author

nobanzai commented Jan 14, 2024

Ok, I "optimized" my import routines using the new import functions.
It seems to work at least partially (except for the prints).
But I don't understand the relationship between script-folder/import-function and virtual-layout/import-script.
I wanted to use the new method and added to my config a script-folder section and a custom folder containing one .js file with an addAudio function. I removed the database and started gerbera, but not my function was used but the default one, so the default layout was created. After setting virtual-layout type to js, once more deleting the database and restarting gerbera, my function was called and the desired layout was created. I didn't set an import-script, though.
To my understanding of the docs it shouldn't be necessary to set virtual-layout to js, if a custom script-folder is set, that contains a jscript with an addAudio function. And on the other hand it shouldn't work, if only virtual-layout is set to js, but no import script is defined.
Is this a bug or a fundamental misunderstaning on my side?

@nobanzai
Copy link
Author

nobanzai commented Jan 14, 2024

I tested a few more things. With debug-mode="script" I got back my print output.
But indeed my own js function only is called with virtual-layout type="js", not with virtual-layout type="builtin".

@KarlStraussberger
Copy link
Member

First of all virtual-layout type="js" is required to execute any js script (except playlist-parser).

The configuration of the javascript engine was changed between 1.12 and 2.0, which means that virtual-layou/import-script will be deprecated soon.

I'm working on a new function print2 to allow control of message type. print will be reverted to the former info level.

Is the inotify issue resolved with the js-layout mode?

@nobanzai
Copy link
Author

First of all virtual-layout type="js" is required to execute any js script (except playlist-parser).

Ok, good to know - so my actual configuration is as it should be for the given purpose.

The configuration of the javascript engine was changed between 1.12 and 2.0, which means that virtual-layou/import-script will be deprecated soon.

Ok.

I'm working on a new function print2 to allow control of message type. print will be reverted to the former info level.

Could it be named like printl or something like that?

Is the inotify issue resolved with the js-layout mode?

Seems so - adding a folder, adding a file to folder, renaming a file and deleting a file or folder works as expected.
Changing a tag does not trigger an action.

If I'd like to ask questions regarding other small problems, where would be the best place?

Thx4all.

@KarlStraussberger
Copy link
Member

NB: You can place you questions in under discussion. Some may already be answered there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants