Skip to content

Bug: thunder-startup-services are bogus as long as other components are sending activation requests #164

@npoltorapavlo

Description

@npoltorapavlo

Problem/Opportunity

thunder-startup-services do not represent thunder plugin. They only represent an activation request. If plugin is already active thunder-startup-services do nothing and dependencies are not used as expected. Check startup with tcpdump:

tcpdump -i any -A port 9998 -w /opt/w.log
sudo apt-get install wireshark
# File/Open w.log
# frame contains "activate" or frame contains "deactivate"

Xcast process activates "org.rdk.Network.1"

{"jsonrpc":"2.0","id":3,"method":"activate","params":{"callsign":"org.rdk.Network.1"}}

root@sky-llama-panel:~# lsof -i :36910
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
WPEFramew 11454 root   19u  IPv4  59173      0t0  TCP localhost.localdomain:9998->localhost.localdomain:36910 (ESTABLISHED)
Xcast     13188 root    8u  IPv4  61217      0t0  TCP localhost.localdomain:36910->localhost.localdomain:9998 (ESTABLISHED)

MediaRite process activates multiple plugins

{"jsonrpc":"2.0","id":2,"method":"activate","params":{"callsign":"org.rdk.MediaSystem"}}
{"jsonrpc":"2.0","id":4,"method":"activate","params":{"callsign":"org.rdk.MediaServices"}}
{"jsonrpc":"2.0","id":6,"method":"activate","params":{"callsign":"org.rdk.System"}}
{"jsonrpc":"2.0","id":18,"method":"activate","params":{"callsign":"org.rdk.DisplaySettings"}}
{"jsonrpc":"2.0","id":23,"method":"activate","params":{"callsign":"org.rdk.PersistentStore"}}

root@sky-llama-panel:~# lsof -i :36928
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
WPEFramew 11454 root   27u  IPv4  64634      0t0  TCP localhost.localdomain:9998->localhost.localdomain:36928 (ESTABLISHED)
MediaRite 12288 root   15u  IPv4  64633      0t0  TCP localhost.localdomain:36928->localhost.localdomain:9998 (ESTABLISHED)

HomeKitTV sends activation requests, even to Controller itself:

{"jsonrpc":"2.0","id":1,"method":"activate","params":{"callsign":"org.rdk.PersistentStore.1"}}
{"jsonrpc":"2.0","id":3,"method":"activate","params":{"callsign":"Controller.1"}}
{"jsonrpc":"2.0","id":4,"method":"activate","params":{"callsign":"DeviceInfo.1"}}
{"jsonrpc":"2.0","id":5,"method":"activate","params":{"callsign":"PlayerInfo.1"}}
{"jsonrpc":"2.0","id":6,"method":"activate","params":{"callsign":"org.rdk.AVInput.1"}}
{"jsonrpc":"2.0","id":7,"method":"activate","params":{"callsign":"org.rdk.DeviceDiagnostics.1"}}
{"jsonrpc":"2.0","id":8,"method":"activate","params":{"callsign":"org.rdk.DisplaySettings.1"}}
{"jsonrpc":"2.0","id":9,"method":"activate","params":{"callsign":"org.rdk.HdmiCecSink.1"}}
{"jsonrpc":"2.0","id":10,"method":"activate","params":{"callsign":"org.rdk.Network.1"}}
{"jsonrpc":"2.0","id":11,"method":"activate","params":{"callsign":"org.rdk.PersistentStore.1"}}
{"jsonrpc":"2.0","id":12,"method":"activate","params":{"callsign":"org.rdk.System.1"}}
{"jsonrpc":"2.0","id":13,"method":"activate","params":{"callsign":"org.rdk.Warehouse.1"}}
{"jsonrpc":"2.0","id":14,"method":"activate","params":{"callsign":"org.rdk.Wifi.1"}}

root@sky-llama-panel:~# lsof -i :38406
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
WPEFramew 11454 root  113u  IPv4  87495      0t0  TCP localhost.localdomain:9998->localhost.localdomain:38406 (ESTABLISHED)
HomeKitTV 20545 root   12u  IPv4  87494      0t0  TCP localhost.localdomain:38406->localhost.localdomain:9998 (ESTABLISHED)

JSPPWebPr:

{"jsonrpc":"2.0","id":6,"method":"activate","params":{"callsign":"org.rdk.SecManager.1"}}
{"jsonrpc":"2.0","id":7,"method":"activate","params":{"callsign":"org.rdk.Watermark.1"}}

root@sky-llama-panel:~# lsof -i :37650
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
WPEFramew 11454 root  107u  IPv4  84279      0t0  TCP localhost.localdomain:9998->localhost.localdomain:37650 (ESTABLISHED)
JSPPWebPr 18378 root   50u  IPv4  83440      0t0  TCP localhost.localdomain:37650->localhost.localdomain:9998 (ESTABLISHED)

"curl" hits frequently from unidentified places with "Controller.1.activate":

POST /jsonrpc HTTP/1.1\x0d\x0aHost: 127.0.0.1:9998\x0d\x0aUser-Agent: curl/7.82.0\x0d\x0aAccept: */*\x0d\x0aContent-Type: application/json\x0d\x0aAuthorization: Bearer \x0d\x0aContent-Length: 105\x0d\x0a\x0d\x0a{"jsonrpc": "2.0","id": 4,"method": "Controller.1.activate", "params": { "callsign": "org.rdk.Network" }}"
POST /jsonrpc HTTP/1.1\x0d\x0aHost: 127.0.0.1:9998\x0d\x0aUser-Agent: curl/7.82.0\x0d\x0aAccept: */*\x0d\x0aContent-Type: application/json\x0d\x0aAuthorization: Bearer \x0d\x0aContent-Length: 109\x0d\x0a\x0d\x0a{"jsonrpc": "2.0","id": 4,"method": "Controller.1.activate", "params": { "callsign": "org.rdk.AuthService" }}"
...

appsserviced de-activates "org.rdk.Watermark", hacks its configuration and re-activates:

# frame contains "com.sky.appsserviced"
# tcp.srcport == 43862
Line-based text data (9 lines)
    {\n
     "id" : 869,\n
     "jsonrpc" : "2.0",\n
     "method" : "activate",\n
     "params" : \n
     {\n
      "callsign" : "org.rdk.AVInput.1"\n
     }\n
    }
Line-based text data (9 lines)
    {\n
     "id" : 870,\n
     "jsonrpc" : "2.0",\n
     "method" : "activate",\n
     "params" : \n
     {\n
      "callsign" : "org.rdk.AuthService.1"\n
     }\n
    }
Line-based text data (9 lines)
    {\n
     "id" : 871,\n
     "jsonrpc" : "2.0",\n
     "method" : "activate",\n
     "params" : \n
     {\n
      "callsign" : "org.rdk.DeviceAppManager.1"\n
     }\n
    }
Line-based text data (9 lines)
    {\n
     "id" : 872,\n
     "jsonrpc" : "2.0",\n
     "method" : "activate",\n
     "params" : \n
     {\n
      "callsign" : "org.rdk.DeviceBridge.1"\n
     }\n
    }
Line-based text data (9 lines)
    {\n
     "id" : 873,\n
     "jsonrpc" : "2.0",\n
     "method" : "activate",\n
     "params" : \n
     {\n
      "callsign" : "org.rdk.MaintenanceManager"\n
     }\n
    }
Line-based text data (9 lines)
    {\n
     "id" : 875,\n
     "jsonrpc" : "2.0",\n
     "method" : "activate",\n
     "params" : \n
     {\n
      "callsign" : "org.rdk.SystemMode"\n
     }\n
    }
Line-based text data (9 lines)
    {\n
     "id" : 876,\n
     "jsonrpc" : "2.0",\n
     "method" : "deactivate",\n
     "params" : \n
     {\n
      "callsign" : "org.rdk.Watermark"\n
     }\n
    }
Line-based text data (9 lines)
    {\n
     "id" : 880,\n
     "jsonrpc" : "2.0",\n
     "method" : "configuration@org.rdk.Watermark",\n
     "params" : \n
     {\n
      "clientidentifier" : "westeros-asplayer-watermark"\n
     }\n
    }
Line-based text data (9 lines)
    {\n
     "id" : 881,\n
     "jsonrpc" : "2.0",\n
     "method" : "activate",\n
     "params" : \n
     {\n
      "callsign" : "org.rdk.Watermark"\n
     }\n
    }

Let's check "HomeKitTV". It's out-of-process plugin org.rdk.HomeKitTV.
In its codebase, it's sending activation requests:
https://github.com/rdk-e/airplay-daemon-cpc/blob/develop/AirPlaySDK/ADK/PAL/RDK/ThunderUtils.cpp

            params["callsign"] = it->first.c_str();
            int rpcRet =  controller->Invoke("activate", params, result);
            if(rpcRet == Core::ERROR_NONE)
                 HAPLogDebug(&kHAPLog_Default, "Activated %s plugin",it->first.c_str());

startup service doesn't exist, "autostart": false. It's activating from elsewhere too

"MediaRite" is mediarite.service. Its dependencies are:

After=pwrmgr.service wpeframework.service

however it sends "org.rdk.PersistentStore" activation request thus breaks PersistentStore (it should start After securemount.service)

Here's /lib/rdk/airplay-daemon.sh , it sends curl activation requests:

        curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token"  'http://127.0.0.1:9998/jsonrpc' -d '{"jsonrpc": "2.0","id": 4,"method": "Controller.1.activate", "params": { "callsign": "org.rdk.Network" }}'
        curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token"  'http://127.0.0.1:9998/jsonrpc' -d '{"jsonrpc": "2.0","id": 4,"method": "Controller.1.activate", "params": { "callsign": "org.rdk.AuthService" }}'

it's airplay-daemon.service:

root@sky-llama-panel:~# lsof /lib/rdk/airplay-daemon.sh
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sh      16169 root  255r   REG  251,0    10866 2285 /lib/rdk/airplay-daemon.sh
root@sky-llama-panel:~# systemctl status 16169|grep service
● airplay-daemon.service - Airplay Deamon running on RDK

and it has no meaningful dependencies as well:

After=wpeframework.service mdns.service

i.e starts parallel to thunder-startup-services and breaks its dependencies

Steps to reproduce

No response

Expected Behavior

If you wanted to configure startup order with thunder-startup-services then no other places should send any activation requests

Actual Behavior

Activation requests come from anywhere, thunder-startup-services dependencies are bypassed, real order is undefined and works by chance

Notes (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions