Permission denied (g-file-error-quark, 2)

I’m close to completing my Snap file, so now I’m testing it in strict/stable mode.

My Python3 app opens up fine, but in my app when I bring up a GTK3 FileChooser dialog to save a file, I get this warning:

Error creating IO channel for /proc/self/mountinfo: Permission denied (g-file-error-quark, 2)

I’m attempting to save to my home / pictures folder.

And then at the end, it says permission denied.

PermissionError: [Errno 13] Permission denied

The snapcraft.yaml configuration of my app has the following:

apps:
  openresizer:
    command: desktop-launch $SNAP/bin/openresizer.py
    environment:
      XDG_DATA_DIRS: $SNAP/usr/share:$XDG_DATA_DIRS
    plugs: [gnome-3-28-1804, x11, unity7, pulseaudio, wayland, desktop, desktop-legacy, gsettings, home, removable-media]
    desktop: bin/gui/openresizer.desktop

These are the interfaces that app is connected to:

Interface                 Plug                         Slot                             Notes
content[gnome-3-28-1804]  openresizer:gnome-3-28-1804  gnome-3-28-1804:gnome-3-28-1804  -
content[gtk-3-themes]     openresizer:gtk-3-themes     gtk-common-themes:gtk-3-themes   -
content[icon-themes]      openresizer:icon-themes      gtk-common-themes:icon-themes    -
content[sound-themes]     openresizer:sound-themes     gtk-common-themes:sound-themes   -
desktop                   openresizer:desktop          :desktop                         -
desktop-legacy            openresizer:desktop-legacy   :desktop-legacy                  -
gsettings                 openresizer:gsettings        :gsettings                       -
home                      openresizer:home             :home                            -
pulseaudio                openresizer:pulseaudio       :pulseaudio                      -
removable-media           openresizer:removable-media  -                                -
unity7                    openresizer:unity7           :unity7                          -
wayland                   openresizer:wayland          :wayland                         -
x11                       openresizer:x11              :x11                             -

My app uses Python’s multiprocessing module, which I suspect could be causing permission errors in strict mode?
For example, this is the error that shows up when I attempt to save a file in the GTK3 FileChooser dialog (my save method uses the multiprocessing module):

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/snap/openresizer/x1/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/snap/openresizer/x1/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/snap/openresizer/x1/bin/openresizer.py", line 1984, in begin_resize
    pool = Pool()
  File "/snap/openresizer/x1/usr/lib/python3.6/multiprocessing/context.py", line 119, in Pool
    context=self.get_context())
  File "/snap/openresizer/x1/usr/lib/python3.6/multiprocessing/pool.py", line 156, in __init__
    self._setup_queues()
  File "/snap/openresizer/x1/usr/lib/python3.6/multiprocessing/pool.py", line 249, in _setup_queues
    self._inqueue = self._ctx.SimpleQueue()
  File "/snap/openresizer/x1/usr/lib/python3.6/multiprocessing/context.py", line 112, in SimpleQueue
    return SimpleQueue(ctx=self.get_context())
  File "/snap/openresizer/x1/usr/lib/python3.6/multiprocessing/queues.py", line 315, in __init__
    self._rlock = ctx.Lock()
  File "/snap/openresizer/x1/usr/lib/python3.6/multiprocessing/context.py", line 67, in Lock
    return Lock(ctx=self.get_context())
  File "/snap/openresizer/x1/usr/lib/python3.6/multiprocessing/synchronize.py", line 162, in __init__
    SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
  File "/snap/openresizer/x1/usr/lib/python3.6/multiprocessing/synchronize.py", line 59, in __init__
    unlink_now)
PermissionError: [Errno 13] Permission denied

Any ideas?

My full snapcraft.yaml is also available.

The mountinfo denial is almost certainly just noise. You can plugs and connect ‘mount-observe’ if you want to be sure. You didn’t post security policy violations from journalctl, but since you mention that python module, you may want to look at: Python multiprocessing sem_open blocked in strict mode

Thanks, the multiprocessing module in Python 3 seems to be working now.

snapcraft-preload.git was needed, from the source-branch: semaphore-support
I have included an example below.

Also, my command: line had to be changed a bit. It was like this before:
command: desktop-launch $SNAP/bin/openresizer.py

I changed it to:
command: desktop-launch snapcraft-preload $SNAP/bin/openresizer.py

After those 2 changes, multiprocessing works in Python 3.

A section of my snapcraft.yaml file now looks like this:

parts:          
  snapcraft-preload:
    source: https://github.com/diddledan/snapcraft-preload.git
    source-branch: semaphore-support
    plugin: cmake
    build-packages:
      - gcc-multilib
      - g++-multilib


apps:
  openresizer:
    command: desktop-launch snapcraft-preload $SNAP/bin/openresizer.py
    environment:
      XDG_DATA_DIRS: $SNAP/usr/share:$XDG_DATA_DIRS
    plugs: [gnome-3-28-1804, x11, unity7, pulseaudio, wayland, desktop, desktop-legacy, gsettings, home, removable-media, mount-observe]
    desktop: bin/gui/openresizer.desktop