commontorizon / Containerfiles

Common Torizon Containerfiles for the community Container Images
MIT License
1 stars 6 forks source link

renderer process crash in cog container on Toradex Verdin iMX8M-Plus #17

Open escherstair opened 2 months ago

escherstair commented 2 months ago

I used cog container from commontorizon/cog:3.3.1 on my Verdin iMX8M-Plus running Torizon OS 6.7.0+build.18

I launch it using my docker compose

kiosk:
    command: http://172.17.0.1:3000/
    depends_on:
      weston:
        condition: service_started
    device_cgroup_rules:
      - c 199:* rmw
    environment:
      MACHINE: null
      ALSA_CARD: audiohdmi
    image: commontorizon/cog:3.3.1
    platform: linux/arm64
    security_opt:
      - seccomp:unconfined
    shm_size: 4Gb
    privileged: true
    volumes:
      - source: /tmp
        target: /tmp
        type: bind
      - source: /var/run/dbus
        target: /var/run/dbus
        type: bind
      - source: /dev/galcore
        target: /dev/galcore
        type: bind

On http://172.17.0.1:3000/ there is my application (it works if I use torizon/chromium container). The renderer process crashed with the following errors immagine

Is there any missing parameter in my docker-compose.yml?

microhobby commented 2 months ago

Hey @escherstair probably because for the iMX8MP you need to use the GPU specific image: commontorizon/cog-imx8:3.3.1, let me know.

escherstair commented 2 months ago

Hi @microhobby I tried with commontorizon/cog-imx8:3.3.1 and the situation seems better. I can successfully view https://www.toradex.com, but when I try to access my Next.js application I get the following crash

docker-compose-kiosk-1   | Could not determine the accessibility bus address
docker-compose-kiosk-1   |
docker-compose-kiosk-1   | (cog:1): GLib-GIO-WARNING **: 08:44:15.250: Your application does not implement g_application_activate() and has no handlers connected to the 'activate' signal.  It should do one of these.
docker-compose-kiosk-1   | Cog-Core-Message: 08:44:15.615: <http://172.17.0.1:3000/> Load started.
docker-compose-kiosk-1   | Cog-Core-Message: 08:44:21.139: <http://172.17.0.1:3000/> Loading...
docker-compose-kiosk-1   | Cog-Core-Message: 08:44:24.522: <http://172.17.0.1:3000/> Loaded successfully.
docker-compose-kiosk-1   | GStreamer element appsink not found. Please install it
docker-compose-kiosk-1   | GStreamer element autoaudiosink not found. Please install it
docker-compose-kiosk-1   |
docker-compose-kiosk-1   | (WPEWebProcess:16): GLib-GObject-WARNING **: 08:44:25.436: invalid (NULL) pointer instance
docker-compose-kiosk-1   |
docker-compose-kiosk-1   | (WPEWebProcess:16): GLib-GObject-CRITICAL **: 08:44:25.437: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
docker-compose-kiosk-1   |
docker-compose-kiosk-1   | (cog:1): Cog-Core-WARNING **: 08:44:25.483: <http://172.17.0.1:3000/> Crash!: The renderer process crashed. Reloading the page may fix intermittent failures.
docker-compose-kiosk-1   | Cog-Core-Message: 08:44:25.725: <http://172.17.0.1:3000/> Load started.
docker-compose-kiosk-1   | Cog-Core-Message: 08:44:25.731: <http://172.17.0.1:3000/> Loading...
docker-compose-kiosk-1   | Cog-Core-Message: 08:44:25.745: <http://172.17.0.1:3000/> Loaded successfully.

and I see on the crfeen an error page with the message Crash! http://172.17.0.1:3000/ The renderer process crashed. Reloading the page may fix intermittent failures.

with a button "Try again"

microhobby commented 2 months ago

These messages sound interesting:

GStreamer element appsink not found. Please install it
GStreamer element autoaudiosink not found. Please install it

Your page probably uses something that COG depends on GStreamer behind the scenes 🤔, and it's not installed in the base image.

escherstair commented 2 months ago

Hi @microhobby as far as I understand, GStreamer is involved in video playing. My page doesn't play any video, only some lottie animations, but I don't think they use GStreamer under the hood. I see that the log complains about autoaudiosink and my page plays some sounds through HDMI, using HTMLAudioElement from node.js. I found this FAQ in the WPE/Cog official website

Why does the browser/launcher (e.g. Cog) crash when trying to play audio? If you are building an embedded system image yourself, make sure that the GStreamer elements autoaudiosink and alsasink are installed. Even if your system uses some other audio output by default (PulseAudio, PipeWire, etc.) ALSA is always tried as the last fallback if all the other available sinks fail.

When I use chromium container, I set this environment variable in docker-compose.yml to play audio:

environment:
      ALSA_CARD: audiohdmi

Do you think this (playing audio/sound) is a general/common need, and so it's worth installing these elements in the base image? Moreover, what is the "base image"? Cog or weston?

microhobby commented 1 month ago

The base is the wayland-base: https://github.com/commontorizon/Containerfiles/blob/7c0d041704b9301f42415db97524bb30e5cb86ce/cog/args.json#L25

Instead, we could create a cog-media with the gstreamer and audio dependencies, we are open to contributions.

escherstair commented 1 month ago

Hi @microhobby thank you very much for your answer. When I asked about the "base image" I would like knowing if I should install autoaudiosink and alsasink either in weston or in cog container. Since I wrote about a cog-media, I would say it's in cog.

I can add that the same error messages are shown when I try to access to https://www.onlinemictest.com/sound-test/ with cog. Anmd this simplifies the test of what happens.

I verified what is already installed in cog-imx8 and here is the result:

dpkg -l | grep gstreamer

ii  libgstreamer-gl1.0-0:arm64           1.22.0-3+toradex1              arm64        GStreamer GL libraries
ii  libgstreamer-plugins-base1.0-0:arm64 1.22.0-3+toradex1              arm64        GStreamer libraries from the "base" set
ii  libgstreamer1.0-0:arm64              1.22.0-2                       arm64        Core GStreamer libraries and elements 

so it seems that something is already installed

Taking inspiration from toradex/dir-gstreamer https://github.com/toradex/torizon-samples/blob/dfc33664a803fa8f431c79c022210a6df572f81e/dlr-gstreamer/Dockerfile#L32-L44 I'll open a PR to create a cog-media that includes GStreamer so that I can test it.