Electron-based Kiosk Snap

@ogra, @cjp256, maybe someone a bit more familiar with electron development could take a look?

To reproduce on an X11 based desktop, install and run mir-kiosk:

snap install mir-kiosk && mir-kiosk

Checkout, build, install and run from the above branch:

git clone --branch electron-example https://github.com/MirServer/mir_kiosk_x11-example.git
cd mir_kiosk_x11-example
snapcraft && snap install --dangerous *_amd64.snap && mir_kiosk_x11-example

This first run SEGFAULTs, but does show a brief “flash” on the “Mir on X11” window.

Subsequent runs of mir_kiosk_x11-example work as expected and display “Hello world” on the “Mir on X11” window.

ELECTRON_ENABLE_LOGGING=1 doesn’t show anything that seems related to the SEGFAULT, and I can delete both ~/snap/mir-kiosk-x11-example/current/* and $XDG_RUNTIME_DIR/snap.mir-kiosk-x11-example/* without getting the segfault.

1 Like

I think there are more incompatibilities with the gnome platform snap.

I got around it by adding a cleanup part to remove potentially conflicting libs:

    after: [electron-quick-start, mir-kiosk-x11]
    plugin: nil
    override-prime: |
      set -eux
      for snap in "core18" "gnome-3-34-1804"; do
          cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;

Then instead of segfault, I see:
The futex facility returned an unexpected error code.Aborted

I’m not sure of the usefulness of this cleanup part. It doesn’t seem to make anything work, and I doubt that conflicting libraries would have the behavior I see. It seems to remove something that is needed.

Setting aside “cleanup” for the moment. (I agree something more robust is needed.)

I’ve made little progress with the electron SIGSEGV. I’ve added a mir_kiosk_x11-example.bash command to make experimentation easier and, using this, can add the following observations:

  1. $SNAP/electron-quick-start/electron-quick-start --no-sandbox
    (without $SNAP/bin/x11_kiosk_launch) works every time including the first.
  2. $SNAP/bin/x11_kiosk_launch $SNAP/electron-quick-start/electron-quick-start --no-sandbox
    works EXCEPT for the first run after an install, a refresh, or a reboot. It also works after command 1 above.

I infer that the first execution of electron-quick-start is changing some state somewhere that leads subsequent executions succeeding. However, I can’t find anything in /tmp/snap.mir-kiosk-x11-example or $XDG_RUNTIME_DIR/snap.mir-kiosk-x11-example that changes between the failing and succeeding executions. (I’ve also looked at ~/snap/mir-kiosk-x11-example but that doesn’t change with a reboot.)

Comparing the strace of a successful (second or subsequent) run with an unsuccessful (first) run doesn’t show anything obvious to me. The unsuccessful run accesses more fonts, but nothing about that looks broken. (Of course, that may just mean there’s a difference in timing as there are a lot of threads in play.)

Similarly, inotifywait -r -m only shows significant differences in ~/snap/mir-kiosk-x11-example - it looks as though the failing first run rebuilds ~/snap/mir-kiosk-x11-example/common/.cache/fontconfig/.

I don’t know what it signifies, but only the failing run accesses ~/snap/mir-kiosk-x11-example/common/.cache/mesa_shader_cache.