File caching with interfaces

I added an interface to sustem file like this:

    interface: system-files
    read: [/etc/myapp.conf]

This works. However, when creating/deleting or modifying myapp.conf the changes are not reflected when reading the file in my app. Only after rebooting the machine the changes become visible to the snap. E.g, After deleting the file it will be still seen by myapp. Only a system reboot will make he file dissappear for the snap. Is there a snap command to force refresh that interface without rebooting?

Firstly for the case of deleting the file: Does your application have an open file handle at the time of deletion? Does stopping and starting your app not update the file state/content?

Perhaps this might be relevant?

The file is only read on startup of the app. But it doesn’t matter if the app run or not when the file get changed. Not even uninstalling reinstalling the snap matter. Only a reboot of the system will finally make a change to file effective to the app. Make me wonder if there is some sort of demon that caches the connection to the file.

Do you mind sharing complete snapcraft.yaml using triple quotes to keep format?

Hi. To my knowledge, there is no caching. I tried reproduce this by rewriting a file and deleting it and, in both cases, the modifications were visible in the snap. Can you try running

snap run --shell <your-snap>

and read the file in that shell, then delete it as you normally do and try to read it again in the snap shell? That should help us narrow down where the issue is coming from.