From: José Bollo Date: Thu, 22 Feb 2018 15:33:28 +0000 (+0100) Subject: memo-supervisor: added a memo for supervisor X-Git-Tag: flounder_5.99.1~56 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-binder.git;a=commitdiff_plain;h=6e11db3cd27b40bdfbf2f1b032cd912a1eb8f156 memo-supervisor: added a memo for supervisor Change-Id: I2bf91ef9b1407d1a72eea3708782836c625ebdc0 Signed-off-by: José Bollo --- diff --git a/memo-supervisor.txt b/memo-supervisor.txt new file mode 100644 index 00000000..6d901003 --- /dev/null +++ b/memo-supervisor.txt @@ -0,0 +1,1102 @@ + +Run the supervisor on the target for the public IP: +--------------------------------------------------- + + # ip address show + + 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever + 2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 + link/ether ee:85:bb:23:a2:26 brd ff:ff:ff:ff:ff:ff + inet 192.168.0.34/24 brd 192.168.0.255 scope global eth0 + valid_lft forever preferred_lft forever + + # afs-supervisor 192.168.0.34:5555/supervisor + +Run the direct client +--------------------- + + # afb-client-demo -H -d 192.168.0.34:5555/ + +It is an issue that supervisor provides a direct client. +This may change in some future to include HTTP websocket negociation and token exchange. + +Commands that can be run: +------------------------- + + - discover + + send SIGHUP to daemons not recorded to make them connected + + - list + + list the connected daemons + + - config {"pid":X} + + get the configuration of the daemon of pid X + + - sessions {"pid":X} + + get the active sessions and token of the daemon of pid X + + - session-close {"pid":X, "uuid":UUID} + + closes the sessions of uuid UUID for the daemon of pid X + + - exit {"pid":X,"code":Y} + + exit the daemon of pid X with optional code Y (default 0) + + - debug-wait {"pid":X} + + make the daemon of pid X wait for a signal SIGINT + + - debug-break {"pid":X} + + make the daemon of pid X self killing with SIGINT + + - do {"pid":X,"api":A,"verb":V,"args":A} + + execute the API/VERB(ARGS) for the daemon of pid X + + usefull for (s/g)etting monitor info. ex: monitor/get({"apis":true}) + + bound to the current client session (to be checked: usurpation of session?) + + - trace {"pid":X, ...} + + like monitor/trace but not bound to session (in the future monitor/trace + will be bound to sessions) + + allows to trace specific session or any session + + actually events generated by tracing are named with the prefix + "$/" (that is the internal prefix of supervision in binders) + could change in future + + the pid isn't returned in the event (not sure to want it but open...) + + use "name" and "tag" feature of "trace" to discrimate events on the client side. + +Examples of dialog: +------------------- + +discover +ON-REPLY-SUCCESS 1:discover: +null + + +list +ON-REPLY-SUCCESS 2:list: +{ + "4123":{ + "pid":4123, + "uid":0, + "gid":0, + "id":"nfc-binding", + "label":"User::App::nfc-binding", + "user":"0" + }, + "4120":{ + "pid":4120, + "uid":0, + "gid":0, + "id":"homescreen-service-2017", + "label":"User::App::homescreen-service-2017", + "user":"0" + }, + "4119":{ + "pid":4119, + "uid":0, + "gid":0, + "id":"homescreen-2017", + "label":"User::App::homescreen-2017", + "user":"0" + }, + "4118":{ + "pid":4118, + "uid":0, + "gid":0, + "id":"agl-service-wifi", + "label":"User::App::agl-service-wifi", + "user":"0" + }, + "4117":{ + "pid":4117, + "uid":0, + "gid":0, + "id":"windowmanager-service-2017", + "label":"User::App::windowmanager-service-2017", + "user":"0" + }, + "4116":{ + "pid":4116, + "uid":0, + "gid":0, + "id":"agl-service-geoclue", + "label":"User::App::agl-service-geoclue", + "user":"0" + }, + "4115":{ + "pid":4115, + "uid":0, + "gid":0, + "id":"persistence-binding", + "label":"User::App::persistence-binding", + "user":"0" + }, + "4113":{ + "pid":4113, + "uid":0, + "gid":0, + "id":"agl-service-bluetooth", + "label":"User::App::agl-service-bluetooth", + "user":"0" + }, + "4114":{ + "pid":4114, + "uid":0, + "gid":0, + "id":"agl-identity-service", + "label":"User::App::agl-identity-service", + "user":"0" + }, + "4112":{ + "pid":4112, + "uid":0, + "gid":0, + "id":"agl-service-unicens", + "label":"User::App::agl-service-unicens", + "user":"0" + }, + "3734":{ + "pid":3734, + "uid":0, + "gid":0, + "id":"System", + "label":"System", + "user":"0" + } +} + + +config {"pid":4117} +ON-REPLY-SUCCESS 4:config: +{ + "console":".\/AFB-console.out", + "rootdir":"\/var\/local\/lib\/afm\/applications\/windowmanager-service-2017\/0.1", + "roothttp":".", + "rootbase":"\/opa", + "rootapi":"\/api", + "workdir":"\/home\/0\/app-data\/windowmanager-service-2017", + "uploaddir":".", + "token":"HELLO", + "name":"afbd-windowmanager-service-2017@0.1", + "aliases":[ + "\/monitoring" + ], + "dbus_clients":[ + ], + "dbus_servers":[ + ], + "ws_clients":[ + ], + "ws_servers":[ + "sd:windowmanager" + ], + "so_bindings":[ + "\/var\/local\/lib\/afm\/applications\/windowmanager-service-2017\/0.1\/lib\/windowmanager-service.so" + ], + "ldpaths":[ + "\/usr\/lib\/afb" + ], + "weak_ldpaths":[ + ], + "calls":[ + ], + "exec":[ + ], + "httpdPort":1039, + "cacheTimeout":100000, + "apiTimeout":20, + "cntxTimeout":32000000, + "nbSessionMax":10, + "mode":"local", + "tracereq":"no", + "traceditf":"no", + "tracesvc":"no", + "traceevt":"no", + "no_ldpaths":false, + "noHttpd":false, + "background":false, + "monitoring":true, + "random_token":false +} + + +sessions {"pid":4117} +ON-REPLY-SUCCESS 5:sessions: +{ + "afb-client-demo":{ + "token":"HELLO" + }, + "fa050ca1-80b4-41af-bf72-4a1a8e7ee5b6":{ + "token":"HELLO" + } +} + + +do {"pid":4117,"api":"monitor","verb":"get","args":{"apis":true}} +ON-REPLY-SUCCESS 6:do: +{ + "apis":{ + "monitor":{ + "openapi":"3.0.0", + "info":{ + "description":"monitoring of bindings and internals", + "title":"monitor", + "version":"1.0", + "x-binding-c-generator":{ + "api":"monitor", + "version":2, + "prefix":"f_", + "postfix":"", + "preinit":null, + "init":null, + "onevent":null, + "scope":"static", + "private":true + } + }, + "servers":[ + { + "url":"ws:\/\/{host}:{port}\/api\/monitor", + "description":"The API server.", + "variables":{ + "host":{ + "default":"localhost" + }, + "port":{ + "default":"1234" + } + }, + "x-afb-events":[ + { + "$ref":"#\/components\/schemas\/afb-event" + } + ] + } + ], + "components":{ + "schemas":{ + "afb-reply":{ + "$ref":"#\/components\/schemas\/afb-reply-v1" + }, + "afb-event":{ + "$ref":"#\/components\/schemas\/afb-event-v1" + }, + "afb-reply-v1":{ + "title":"Generic response.", + "type":"object", + "required":[ + "jtype", + "request" + ], + "properties":{ + "jtype":{ + "type":"string", + "const":"afb-reply" + }, + "request":{ + "type":"object", + "required":[ + "status" + ], + "properties":{ + "status":{ + "type":"string" + }, + "info":{ + "type":"string" + }, + "token":{ + "type":"string" + }, + "uuid":{ + "type":"string" + }, + "reqid":{ + "type":"string" + } + } + }, + "response":{ + "type":"object" + } + } + }, + "afb-event-v1":{ + "type":"object", + "required":[ + "jtype", + "event" + ], + "properties":{ + "jtype":{ + "type":"string", + "const":"afb-event" + }, + "event":{ + "type":"string" + }, + "data":{ + "type":"object" + } + } + }, + "set-verbosity":{ + "anyOf":[ + { + "$ref":"#\/components\/schemas\/verbosity-map" + }, + { + "$ref":"#\/components\/schemas\/verbosity-level" + } + ] + }, + "get-request":{ + "type":"object", + "properties":{ + "verbosity":{ + "$ref":"#\/components\/schemas\/get-verbosity" + }, + "apis":{ + "$ref":"#\/components\/schemas\/get-apis" + } + } + }, + "get-response":{ + "type":"object", + "properties":{ + "verbosity":{ + "$ref":"#\/components\/schemas\/verbosity-map" + }, + "apis":{ + "type":"object" + } + } + }, + "get-verbosity":{ + "anyOf":[ + { + "type":"boolean" + }, + { + "type":"array", + "items":{ + "type":"string" + } + }, + { + "type":"object" + } + ] + }, + "get-apis":{ + "anyOf":[ + { + "type":"boolean" + }, + { + "type":"array", + "items":{ + "type":"string" + } + }, + { + "type":"object" + } + ] + }, + "verbosity-map":{ + "type":"object", + "patternProperties":{ + "^.*$":{ + "$ref":"#\/components\/schemas\/verbosity-level" + } + } + }, + "verbosity-level":{ + "enum":[ + "debug", + 3, + "info", + 2, + "notice", + "warning", + 1, + "error", + 0 + ] + }, + "trace-add":{ + "anyOf":[ + { + "type":"array", + "items":{ + "$ref":"#\/components\/schemas\/trace-add-object" + } + }, + { + "$ref":"#\/components\/schemas\/trace-add-any" + } + ] + }, + "trace-add-any":{ + "anyOf":[ + { + "$ref":"#\/components\/schemas\/trace-add-request" + }, + { + "$ref":"#\/components\/schemas\/trace-add-object" + } + ] + }, + "trace-add-object":{ + "type":"object", + "properties":{ + "name":{ + "type":"string", + "description":"name of the generated event", + "default":"trace" + }, + "tag":{ + "type":"string", + "description":"tag for grouping traces", + "default":"trace" + }, + "api":{ + "type":"string", + "description":"api for requests, daemons and services" + }, + "verb":{ + "type":"string", + "description":"verb for requests" + }, + "uuid":{ + "type":"string", + "description":"uuid of session for requests" + }, + "pattern":{ + "type":"string", + "description":"pattern for events" + }, + "request":{ + "$ref":"#\/components\/schemas\/trace-add-request" + }, + "daemon":{ + "$ref":"#\/components\/schemas\/trace-add-daemon" + }, + "service":{ + "$ref":"#\/components\/schemas\/trace-add-service" + }, + "event":{ + "$ref":"#\/components\/schemas\/trace-add-event" + }, + "session":{ + "$ref":"#\/components\/schemas\/trace-add-session" + }, + "for":{ + "$ref":"#\/components\/schemas\/trace-add" + } + }, + "examples":[ + { + "tag":"1", + "for":[ + "common", + { + "api":"xxx", + "request":"*", + "daemon":"*", + "service":"*" + } + ] + } + ] + }, + "trace-add-request":{ + "anyOf":[ + { + "type":"array", + "items":{ + "$ref":"#\/components\/schemas\/trace-request-names" + } + }, + { + "$ref":"#\/components\/schemas\/trace-request-names" + } + ] + }, + "trace-request-names":{ + "title":"name of traceable items of requests", + "enum":[ + "*", + "addref", + "all", + "args", + "begin", + "common", + "context", + "context_get", + "context_set", + "end", + "event", + "extra", + "fail", + "get", + "json", + "life", + "ref", + "result", + "session", + "session_close", + "session_set_LOA", + "simple", + "store", + "stores", + "subcall", + "subcall_result", + "subcalls", + "subcallsync", + "subcallsync_result", + "subscribe", + "success", + "unref", + "unstore", + "unsubscribe", + "vverbose" + ] + }, + "trace-add-daemon":{ + "anyOf":[ + { + "type":"array", + "items":{ + "$ref":"#\/components\/schemas\/trace-daemon-names" + } + }, + { + "$ref":"#\/components\/schemas\/trace-daemon-names" + } + ] + }, + "trace-daemon-names":{ + "title":"name of traceable items of daemons", + "enum":[ + "*", + "all", + "common", + "event_broadcast_after", + "event_broadcast_before", + "event_make", + "extra", + "get_event_loop", + "get_system_bus", + "get_user_bus", + "queue_job", + "require_api", + "require_api_result", + "rootdir_get_fd", + "rootdir_open_locale", + "unstore_req", + "vverbose" + ] + }, + "trace-add-service":{ + "anyOf":[ + { + "type":"array", + "items":{ + "$ref":"#\/components\/schemas\/trace-service-names" + } + }, + { + "$ref":"#\/components\/schemas\/trace-service-names" + } + ] + }, + "trace-service-names":{ + "title":"name of traceable items of services", + "enum":[ + "*", + "all", + "call", + "call_result", + "callsync", + "callsync_result", + "on_event_after", + "on_event_before", + "start_after", + "start_before" + ] + }, + "trace-add-event":{ + "anyOf":[ + { + "type":"array", + "items":{ + "$ref":"#\/components\/schemas\/trace-event-names" + } + }, + { + "$ref":"#\/components\/schemas\/trace-event-names" + } + ] + }, + "trace-event-names":{ + "title":"name of traceable items of events", + "enum":[ + "*", + "all", + "broadcast_after", + "broadcast_before", + "common", + "create", + "drop", + "extra", + "name", + "push_after", + "push_before" + ] + }, + "trace-add-session":{ + "anyOf":[ + { + "type":"array", + "items":{ + "$ref":"#\/components\/schemas\/trace-session-names" + } + }, + { + "$ref":"#\/components\/schemas\/trace-session-names" + } + ] + }, + "trace-session-names":{ + "title":"name of traceable items for sessions", + "enum":[ + "*", + "addref", + "all", + "close", + "common", + "create", + "destroy", + "renew", + "unref" + ] + }, + "trace-drop":{ + "anyOf":[ + { + "type":"boolean" + }, + { + "type":"object", + "properties":{ + "event":{ + "anyOf":[ + { + "type":"string" + }, + { + "type":"array", + "items":"string" + } + ] + }, + "tag":{ + "anyOf":[ + { + "type":"string" + }, + { + "type":"array", + "items":"string" + } + ] + }, + "uuid":{ + "anyOf":[ + { + "type":"string" + }, + { + "type":"array", + "items":"string" + } + ] + } + } + } + ] + } + } + }, + "paths":{ + "\/get":{ + "description":"Get monitoring data.", + "get":{ + "x-permissions":{ + "session":"check" + }, + "parameters":[ + { + "in":"query", + "name":"verbosity", + "required":false, + "schema":{ + "$ref":"#\/components\/schemas\/get-verbosity" + } + }, + { + "in":"query", + "name":"apis", + "required":false, + "schema":{ + "$ref":"#\/components\/schemas\/get-apis" + } + } + ], + "responses":{ + "200":{ + "description":"A complex object array response", + "content":{ + "application\/json":{ + "schema":{ + "$ref":"#\/components\/schemas\/afb-reply" + } + } + } + } + } + } + }, + "\/set":{ + "description":"Set monitoring actions.", + "get":{ + "x-permissions":{ + "session":"check" + }, + "parameters":[ + { + "in":"query", + "name":"verbosity", + "required":false, + "schema":{ + "$ref":"#\/components\/schemas\/set-verbosity" + } + } + ], + "responses":{ + "200":{ + "description":"A complex object array response", + "content":{ + "application\/json":{ + "schema":{ + "$ref":"#\/components\/schemas\/afb-reply" + } + } + } + } + } + } + }, + "\/trace":{ + "description":"Set monitoring actions.", + "get":{ + "x-permissions":{ + "session":"check" + }, + "parameters":[ + { + "in":"query", + "name":"add", + "required":false, + "schema":{ + "$ref":"#\/components\/schemas\/trace-add" + } + }, + { + "in":"query", + "name":"drop", + "required":false, + "schema":{ + "$ref":"#\/components\/schemas\/trace-drop" + } + } + ], + "responses":{ + "200":{ + "description":"A complex object array response", + "content":{ + "application\/json":{ + "schema":{ + "$ref":"#\/components\/schemas\/afb-reply" + } + } + } + } + } + } + }, + "\/session":{ + "description":"describes the session.", + "get":{ + "x-permissions":{ + "session":"check" + }, + "parameters":[ + { + "in":"query", + "name":"refresh-token", + "required":false, + "schema":{ + "type":"boolean" + } + } + ], + "responses":{ + "200":{ + "description":"A complex object array response", + "content":{ + "application\/json":{ + "schema":{ + "$ref":"#\/components\/schemas\/afb-reply" + } + } + } + } + } + } + } + } + }, + "windowmanager":{ + "openapi":"3.0.0", + "info":{ + "title":"windowmanager", + "version":"0.0.0", + "description":"windowmanager" + }, + "paths":{ + "\/requestsurface":{ + "get":{ + "responses":{ + "200":{ + "description":"requestsurface" + } + } + } + }, + "\/requestsurfacexdg":{ + "get":{ + "responses":{ + "200":{ + "description":"requestsurfacexdg" + } + } + } + }, + "\/activatesurface":{ + "get":{ + "responses":{ + "200":{ + "description":"activatesurface" + } + } + } + }, + "\/deactivatesurface":{ + "get":{ + "responses":{ + "200":{ + "description":"deactivatesurface" + } + } + } + }, + "\/enddraw":{ + "get":{ + "responses":{ + "200":{ + "description":"enddraw" + } + } + } + }, + "\/getdisplayinfo":{ + "get":{ + "responses":{ + "200":{ + "description":"getdisplayinfo" + } + } + } + }, + "\/getareainfo":{ + "get":{ + "responses":{ + "200":{ + "description":"getareainfo" + } + } + } + }, + "\/wm_subscribe":{ + "get":{ + "responses":{ + "200":{ + "description":"wm_subscribe" + } + } + } + }, + "\/list_drawing_names":{ + "get":{ + "responses":{ + "200":{ + "description":"list_drawing_names" + } + } + } + }, + "\/ping":{ + "get":{ + "responses":{ + "200":{ + "description":"ping" + } + } + } + }, + "\/debug_status":{ + "get":{ + "responses":{ + "200":{ + "description":"debug_status" + } + } + } + }, + "\/debug_layers":{ + "get":{ + "responses":{ + "200":{ + "description":"debug_layers" + } + } + } + }, + "\/debug_surfaces":{ + "get":{ + "responses":{ + "200":{ + "description":"debug_surfaces" + } + } + } + }, + "\/debug_terminate":{ + "get":{ + "responses":{ + "200":{ + "description":"debug_terminate" + } + } + } + } + } + } + } +} + + +trace { "pid": 4117, "add": { "request": "common" } } +ON-EVENT-CREATE: [4:$/trace] +ON-EVENT-SUBSCRIBE 15:trace: [4:$/trace] +ON-REPLY-SUCCESS 15:trace: +null + + +ON-EVENT-PUSH: [4:$/trace] +{ + "time":"30862.255651", + "tag":"trace", + "type":"request", + "id":51, + "request":{ + "index":5, + "api":"hello", + "verb":"ping", + "action":"begin", + "session":"fa050ca1-80b4-41af-bf72-4a1a8e7ee5b6" + } +} +ON-EVENT-PUSH: [4:$/trace] +{ + "time":"30862.255788", + "tag":"trace", + "type":"request", + "id":52, + "request":{ + "index":5, + "api":"hello", + "verb":"ping", + "action":"json", + "session":"fa050ca1-80b4-41af-bf72-4a1a8e7ee5b6" + }, + "data":{ + "result":{ + "toto":"1" + } + } +} +ON-EVENT-PUSH: [4:$/trace] +{ + "time":"30862.255871", + "tag":"trace", + "type":"request", + "id":53, + "request":{ + "index":5, + "api":"hello", + "verb":"ping", + "action":"success", + "session":"fa050ca1-80b4-41af-bf72-4a1a8e7ee5b6" + }, + "data":{ + "result":"Some String", + "info":"Ping Binder Daemon tag=pingSample count=1 query={ \"toto\": \"1\" }" + } +} +ON-EVENT-PUSH: [4:$/trace] +{ + "time":"30862.255980", + "tag":"trace", + "type":"request", + "id":54, + "request":{ + "index":5, + "api":"hello", + "verb":"ping", + "action":"end", + "session":"fa050ca1-80b4-41af-bf72-4a1a8e7ee5b6" + } +} + +