Flutter app and snapcracft UNIX socket access

Hi,

I have an app written in flutter that compiles as snap package. The application communicates with a daemon over gRPC using a UNIX socket from /run. For this I’ve created a plug:

plugs:
  daemon-socket:
    interface: system-files
    read:
      - /run/daemon/daemon.sock
    write:
      - /run/daemon/daemon.sock

I’m executing this to have access to the socket: sudo snap connect app:daemon-socket.

The problem is(tested on Ubuntu 22.04) that if I run the command while the application is running, only the first time, the app is not able to access anymore the asset images. The images work fine before connecting the plug. As a fix I need to restart the app. If I disconnect the the plug, restart the app and the reconnect, everything works fine.

Is there an issues with system-files or I’m missing something? Thanks

Found something interesting:

  • while the app is running I can see that the assets folder is opened(with lsof), but after I connect the plug the path folder changes: /snap/app/x1/data/flutter_assets is before connecting the plug, changes to /flutter_assets. Because of this no image can be opened.
  • another test I’ve started the app shell, snap run --shell app, and I can ls the images from assets. The while the shell is running, from another terminal I connect the plug. After this I don’t have access to the assets anymore from the app shell. Cannot even start the app from it $SNAP/app because it is not accessible anymore.

In both cases restarting the app or the shell fixes this.