Cog CRITICAL WebKitWebViewBackend

Hello,

What I’m trying to do?

  • Creating a new image using Torizon core builder … Image booted with my new pre provisioned docker containers, drivers, and modules.

What is in the bundle - pre provisioned dockers?

  • Weston (torizon/weston-vivante:2) (will not be added down)
  • myapp (will not be added down)
  • portainer (will not be added down)
  • kiosk (kiosk-mode-browser-vivante:2) (will be added down)
    • here I created my own dockerfile, so I can add the ‘wait-for-it.sh’ which in its turn waits on my app to run first.

docker-compose.yml:

kiosk:
    image: registry.myapp.com:5000/kiosk/kiosk:0.0.1
    platform: linux/arm64
    restart: on-failure
    environment:
      - KIOSK_LAUNCHER=cog
      - KIOSK_ARGS=--webprocess-failure=exit
    container_name: kiosk
    entrypoint: []
    command: ["wait-for-it", "myapp:3000", "-t", "10", "--", "/usr/bin/start-browser", "http://myapp:3000"]
    device_cgroup_rules:
      # ... for /dev/dri devices
      - 'c 199:* rmw'
    volumes:
      - type: bind
        source: /tmp
        target: /tmp
      - type: bind
        source: /var/run/dbus
        target: /var/run/dbus
      - type: bind
        source: /dev/galcore
        target: /dev/galcore
    depends_on:
      weston:
        condition: service_healthy
      myapp:
        condition: service_started

What Fails then?

  • On first boot, the kiosk opens myapp and delivers the page up, and everything works fine.

The error occurs after restarting the device (second boot), I see by logs from kiosk this:

** (cog:1): WARNING **: 13:33:19.850: Platform setup failed: Could not open Wayland display
** (cog:1): CRITICAL : 13:33:19.858: WebKitWebViewBackend webkit_web_view_backend_new(wpe_view_backend, GDestroyNotify, gpointer): assertion ‘backend’ failed
** (cog:1): ERROR **: 13:33:19.859: Could not instantiate any WPE backend.

By restarting the kiosk container, everything works fine, this happens only by restarting the device can you please help?

Note: KIOSK_ARGS=–webprocess-failure=exit will not exit the container, but only cog found in the container, nevertheless =restart had not functioned as well.


Colibri iMX8DX 1GB V1.0D
Iris Carrier Board V2.0
TorizonCore (2022-04-09 | 5.6.0+build.13)

Greetings @pkg_su,

Based off the information you provided it sounds like possibly a race condition. It seems perhaps the kiosk container is starting before Weston is fully ready. That might explain why Cog complains about Could not open Wayland display.

In your docker-compose snippet I see you have kiosk container depending on the Weston container. However, all depends_on guarantees is that the Weston container simply starts before the kiosk. It does not explicitly guarantee that the Weston process inside the container will be complete and ready before kiosk.

Meaning race condition could be possible here. A sanity check would be to add some startup-script to the Kiosk container that delays the starting of Cog, maybe with some sleep statements. Then see if you can reproduce the issue with the newly added delay. If the added delay seems to fix the issue then it was probably a race condition.

Best Regards,
Jeremias

Hello @jeremias.tx

You are right, racing condition is happening here. However, sleep condition is not a solution to check if Cog is well booted or not, is there another way to check if Cog well booted or not ?

I have one idea that might work. Weston creates a socket a Unix socket file in /tmp. This is what other graphical processes, like the Kiosk container use to communicate with Weston. You could use the healtcheck property of docker-compose files to test for the existance of this socket. Then the Weston container will only be seen as “healthy” if this healthcheck passes. Then in theory your depends_on for the kiosk will only pass if the weston container starts and the healthcheck passes.

Best Regards,
Jeremias

OK thanks, yeah that can be a logical approach to do.

Let me know how this works out for you.

Yeah, it does, thanks ! However, I also do perform a bit of delay, so I can be sure the system will always be available.

1 Like

Glad to hear everything worked out, glad I could be of assistance.