Error "Windowmanager-service is not initialized" when launching a webapp

Cannot Reproduce

Description

We are getting this error sometimes when we tried to launch a webapp:

Feb 04 11:22:52 raspberrypi4 WebAppMgr[548]: [0204/112252.541210:INFO:CONSOLE(5)] "webapps-settings@0.0", source: http://localuser--32:8080/index.js (5)
Feb 04 11:22:52 raspberrypi4 WebAppMgr[548]: [0204/112252.563014:INFO:CONSOLE(5)] "Uncaught (in promise) ReferenceError: log is not defined", source: http://localuser--32:8080/index.js (5)
Feb 04 11:22:52 raspberrypi4 systemd[1]: Starting HTML5 SETTINGS demo...
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ------BEGIN OF CONFIG-----
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – {
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "name": "afbd-webapps-settings@0.0",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "rootdir": "/var/local/lib/afm/applications/webapps-settings/0.0",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "workdir": "/home/1001/app-data/webapps-settings",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "monitoring": true,
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "port": 30036,
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "interface": [
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "tcp:localuser--36:8080"
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – ],
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "roothttp": ".",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "alias": [
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "/icons:/var/local/lib/afm/icons",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "/monitoring:/usr/lib/afb/monitoring"
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – ],
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "ws-client": [
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "unix:/run/user/1001/apis/ws/windowmanager",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "unix:/run/user/1001/apis/ws/homescreen",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "unix:/run/user/1001/apis/ws/network-manager",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "unix:/run/user/1001/apis/ws/Bluetooth-Manager"
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – ],
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "exec": [
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "/usr/bin/cynagoauth-launch",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "/usr/bin/web-runtime",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "http://localuser--36:8080/index.html"
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – ],
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "apitimeout": 20,
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "cache-eol": 100000,
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "cntxtimeout": 32000000,
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "session-max": 200,
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "uploaddir": ".",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "rootbase": "/opa",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "rootapi": "/api",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "ldpaths": [
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – "/usr/lib/afb"
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – ]
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: – }
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ------END OF CONFIG-----
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: INFO: running with pid 747 /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/main-afb-daemon.c:978,main
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: INFO: API monitor added /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-apiset.c:510,afb_apiset_add
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: INFO: Can't acces socket path /run/platform/supervisor: No such file or directory /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-supervision.c:164,try_connect_supervisor
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: INFO: Scanning dir=/usr/lib/afb for bindings /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-api-so.c:176,adddirs
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: INFO: Scanning dir=/usr/lib/afb/monitoring for bindings /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-api-so.c:176,adddirs
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ERROR: can't open client socket for unix:/run/user/1001/apis/ws/windowmanager /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-socket.c:352,afb_socket_open_scheme
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ERROR: can't open client socket for unix:/run/user/1001/apis/ws/homescreen /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-socket.c:352,afb_socket_open_scheme
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ERROR: can't open client socket for unix:/run/user/1001/apis/ws/network-manager /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-socket.c:352,afb_socket_open_scheme
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ERROR: can't open client socket for unix:/run/user/1001/apis/ws/Bluetooth-Manager /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-socket.c:352,afb_socket_open_scheme
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: NOTICE: API monitor starting... /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-apiset.c:808,start_api
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: INFO: API monitor started /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-apiset.c:827,start_api
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: INFO: Alias for url=/icons to path=/var/local/lib/afm/icons /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/main-afb-daemon.c:299,init_alias
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: INFO: Alias for url=/monitoring to path=/usr/lib/afb/monitoring /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/main-afb-daemon.c:299,init_alias
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: NOTICE: Serving rootdir=/var/local/lib/afm/applications/webapps-settings/0.0 uploaddir=. /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/main-afb-daemon.c:401,start_http_server
Feb 04 11:22:52 raspberrypi4 systemd[1]: Started HTML5 SETTINGS demo.
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: NOTICE: Listening interface *:30036 /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-hsrv.c:557,hsrv_itf_connect
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: NOTICE: Browser URL= http://localhost:30036 /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/main-afb-daemon.c:416,start_http_server
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: NOTICE: Listening interface localuser--36:8080 /home/igalia/apuentes/agl-master-rpi4/build/tmp/work/aarch64-agl-linux/af-binder/master+gitAUTOINC+65353dce81-r0/git/src/afb-hsrv.c:557,hsrv_itf_connect
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[int main(int, const char**)] ### Starting /usr/bin/web-runtime
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[virtual int WebRuntimeAGL::run(int, const char**)] WebRuntimeAGL::run
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[virtual int WebRuntimeAGL::run(int, const char**)] WebRuntimeAGL - creating WebAppLauncherRuntime
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[int WamSocketLockFile::openLockFile()] Failed to open lock file descriptor
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[virtual int WebAppLauncherRuntime::run(int, const char**)] WebAppLauncherRuntime::run - creating SharedBrowserProcessWebAppLauncher
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] 0: http://localuser--36:8080/index.html
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] 1: http:
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] 2: http
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] 3: //localuser--36:8080
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] 4: localuser--36:8080
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] 5: /index.html
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] 6:
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] 7:
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] 8:
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] 9:
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[int WebAppLauncherRuntime::parse_config(const char*)] id: webapps-settings
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[int WebAppLauncherRuntime::parse_config(const char*)] version: 0.0.0
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[int WebAppLauncherRuntime::parse_config(const char*)] name: SETTINGS
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[int WebAppLauncherRuntime::parse_config(const char*)] content: index.html
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[int WebAppLauncherRuntime::parse_config(const char*)] description: HTML5 SETTINGS demo
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[int WebAppLauncherRuntime::parse_config(const char*)] author: Igalia, S.L.
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[int WebAppLauncherRuntime::parse_config(const char*)] icon: icon.svg
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] id=[webapps-settings@0.0], name=[SETTINGS], role=[webapps-sett], url=http://localuser--36:8080/index.html?token=QhY0VacUQPsFD4L0ItEHcVRUaQwIn4wh, host=[localuser--36], port=8080, token=[QhY0VacUQPsFD4L0ItEHcVRUaQwIn4wh]
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: [1120008.841] [libwm ERROR] [libwindowmanager.cpp, operator()(), Line:532] >>> Windowmanager-service is not initialized: {
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: "jtype":"afb-reply",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: "request":{
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: "status":"unknown-api",
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: "info":"api windowmanager not found (for verb GetDisplayInfo)"
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: }
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: }
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: [1120008.963] [libwm ERROR] [libwindowmanager.cpp, api_call(), Line:753] >>> calling windowmanager/GetDisplayInfo failed: Success
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: [1120009.015] [libwm ERROR] [libwindowmanager.cpp, getDisplayInfo(), Line:538] >>> api_call() failed
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init_wm()] cannot initialize windowmanager
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ## (DEBUG)[bool WebAppLauncherRuntime::init()] cannot setup wm API
Feb 04 11:22:52 raspberrypi4 afbd-webapps-settings@0.0[747]: ...parse_config...

Environment

None

Activity

Show:

José Dapena Paz 
June 20, 2022 at 5:23 PM

Cannot reproduce this anymore on Needlefish (and likely marlin)

Bogdan Ilies 
March 3, 2020 at 6:56 PM
(edited)

Hello,

I was further investigating into this issue and it seems like if you remove --port then for native app when it runs this command the port is not replaced:

ExecStart=/usr/bin/afb-daemon \ --name afbd-test-agl-native@0.0 \ --rootdir=/var/local/lib/afm/applications/test-agl-native/0.0 \ --workdir=/home/%i/app-data/test-agl-native \ --verbose \ --verbose \ --monitoring \ --port=30009 \ --interface=tcp:localuser--9:8080 \ --roothttp=. \ --exec /var/local/lib/afm/applications/test-agl-native/0.0/bin/helloworld-native-application @p @t

Even though in this case the @p argument is used as the port to which this app is supposed to connect.

As I can see there is no clear way of registering/retrieving services and their ports. Can anybody confirm this?

 

Regards,

Bogdan Ilies

Bogdan Ilies 
March 1, 2020 at 2:41 PM

Hello,

I was looking into this issue and it seems to be only development image.

The root cause is that when app is installed then its associated unit configuration is using a fixed port number which is assigned during install. see:

https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/app-framework-main.git;a=blob;f=conf/unit/binder.inc;h=a7188e041f09fe77f568ae7c30fd1b5b6ff3208c;hb=HEAD

IF_AGL_DEVEL \   --verbose \   --verbose \   --monitoring \   --port=\{{:#metatarget.http-port}} \   --interface=tcp:LOCALUSERAPP:8080 \   --roothttp=ON_CONTENT(application/vnd.agl.service, ., ON_PERM(:public:no-htdocs, ., htdocs)) \ ELSE \

and because there are two users agl-driver and agl-passenger and for each one systemd is trying to start afm-service-windowmanager-service--0.1–main@1001.service, afm-service-windowmanager-service--0.1–main@1002.service respectively, one of them is going to fail as both are trying to use same port.

So when you try to start your app under the user for which windowmanager-service failed you are going to see the problem pointed in description.

I am not sure about the original purpose of having "fixed" binding port for development, so I don't know if we should remove it or not.

Workaround (if you don't care about that port) is to remove --port={{:#metatarget.http-port}} from /usr/local/lib/systemd/system/afm-service-windowmanager-service--0.1–main@.service and from /etc/afm/afm-unit.conf

First one is for already installed windowmanager-service and second is for apps that you are installing afterwards.

From what I can see only webapps and bindings are affected by this as they are using this configuration.

Hope this makes sense and helps.

Anybody with more experience please advise if we should remove that flag and if that is the case I can create a patch otherwise maybe this ticket can be closed.

 

Regards,

Bogdan Ilies

 

Details

Assignee

Reporter

Labels

Affects versions

Priority

Created February 4, 2020 at 11:31 AM
Updated June 29, 2022 at 10:02 PM
Resolved June 20, 2022 at 5:23 PM

Flag notifications