diff --git a/examples/README.md b/examples/README.md index 37a6786c..6ffd56b6 100644 --- a/examples/README.md +++ b/examples/README.md @@ -32,24 +32,3 @@ There is an interactive mode that walks you through two demo scenarios. This mode requires the run.sh script to be executed **in an active tmux** session. `cd demo && ./run.sh tmux` - -There is also a recording of the demo available at [demo_recording.mp4](demo_recording.mp4). - -### Demo Scenario 1: Launch Manager - -![Launch Manager Demo Scenario](demo_setup1.png) - -* The system is setup with four ProcessGroups, each with a Startup and Recovery state. -* By default, only the Main ProcessGroup will be started in the Startup state and remaining ProcessGroups are off initially. -* The Startup state is starting the HealthMonitor + 100 application processes, 50 of which are supervised by the HealthMonitor. -* The Recovery state is just running a single application process, that is being restarted in verbose mode when transitioning from Startup to Recovery state. -* During the demo, a non-supervised application process is killed. Subsequently, LaunchManager is detecting the crash and moving the Main ProcessGroup to the Recovery state. Now, only a single application process is running with verbose logging showing up in the console. - -### Demo Scenario 2: Health Monitor - -![Launch Manager Demo Scenario](demo_setup2.png) - -* As explained above, the Main ProcessGroup contains 50 processes being supervised by the HealthMonitor. -* Each of these processes cyclically reports three checkpoints. -* For each of these processes, the HealthMonitor is evaluating an Alive, Deadline and Logical supervision every 50ms. -* During the demo, a supervised application is triggered to misreport checkpoints. Subsequently, supervisions for this application will fail and the HealthMonitor will initiate transition of the ProcessGroup into the Recovery state. Now, only a single application process is running with verbose logging showing up in the console. \ No newline at end of file diff --git a/examples/config/gen_health_monitor_cfg.py b/examples/config/gen_health_monitor_cfg.py index 00daf8b1..f79f6a30 100644 --- a/examples/config/gen_health_monitor_cfg.py +++ b/examples/config/gen_health_monitor_cfg.py @@ -125,94 +125,6 @@ def get_alive_supervisions(index: int, process_group: str): ) -def get_deadline_supervisions(index: int, process_group: str): - # Every demo app has three checkpoints and the first+second checkpoints are used for deadline supervision - sourceCpIndex = index * 3 - targetCpIndex = sourceCpIndex + 1 - return ( - """ -{ - "ruleContextKey": "DeadlineSupervision""" - + str(index) - + """", - "maxDeadline": 80.0, - "minDeadline": 40.0, - "checkpointTransition": { - "refSourceCPIndex": """ - + str(sourceCpIndex) - + """, - "refTargetCPIndex": """ - + str(targetCpIndex) - + """ - }, - "refProcessIndices": [""" - + str(index) - + '''], - "refProcessGroupStates": [ - { - "identifier": "''' - + process_group - + """/Startup" - } - ] -} -""" - ) - - -def get_logical_supervisions(index: int, process_group: str): - # Every demo app has three checkpoints and all three checkpoints in sequence are used for logical supervision - startCpIndex = index * 3 - return ( - """ -{ - "ruleContextKey": "LogicalSupervision""" - + str(index) - + """", - "checkpoints": [ - { - "refCheckPointIndex": """ - + str(startCpIndex) - + """, - "isInitial": true, - "isFinal": false - }, - { - "refCheckPointIndex": """ - + str(startCpIndex + 1) - + """, - "isInitial": false, - "isFinal": false - }, - { - "refCheckPointIndex": """ - + str(startCpIndex + 2) - + """, - "isInitial": false, - "isFinal": true - }], - "transitions": [{ - "checkpointSourceIdx": 0, - "checkpointTargetIdx": 1 - },{ - "checkpointSourceIdx": 1, - "checkpointTargetIdx": 2 - }], - "refProcessIndices": [""" - + str(index) - + '''], - "refProcessGroupStates": [ - { - "identifier": "''' - + process_group - + """/Startup" - } - ] -} -""" - ) - - def get_local_supervisions(index: int): return ( """ @@ -316,8 +228,6 @@ def gen_health_monitor_cfg_for_process_group( monitorInterfaces = [] checkpoints = [] hmAliveSupervisions = [] - hmDeadlineSupervisions = [] - hmLogicalSupervisions = [] hmLocalSupervisions = [] hmGlobalSupervision = [] hmRecoveryNotifications = [] @@ -335,12 +245,6 @@ def gen_health_monitor_cfg_for_process_group( hmAliveSupervisions.append( json.loads(get_alive_supervisions(process_index, process_group)) ) - # hmDeadlineSupervisions.append( - # json.loads(get_deadline_supervisions(process_index, process_group)) - # ) - # hmLogicalSupervisions.append( - # json.loads(get_logical_supervisions(process_index, process_group)) - # ) hmLocalSupervisions.append(json.loads(get_local_supervisions(process_index))) hmGlobalSupervision.append( @@ -360,8 +264,6 @@ def gen_health_monitor_cfg_for_process_group( config["hmMonitorInterface"].extend(monitorInterfaces) config["hmSupervisionCheckpoint"].extend(checkpoints) config["hmAliveSupervision"].extend(hmAliveSupervisions) - config["hmDeadlineSupervision"].extend(hmDeadlineSupervisions) - config["hmLogicalSupervision"].extend(hmLogicalSupervisions) config["hmLocalSupervision"].extend(hmLocalSupervisions) config["hmGlobalSupervision"].extend(hmGlobalSupervision) config["hmRecoveryNotification"].extend(hmRecoveryNotifications) diff --git a/examples/control_application/BUILD b/examples/control_application/BUILD index a26e78b1..ddb814f5 100644 --- a/examples/control_application/BUILD +++ b/examples/control_application/BUILD @@ -17,14 +17,12 @@ cc_binary( "control_app_cli.cpp", ], copts = select({ - "//config:build_qnx8": [], - "//config:x86_64-qnx": [], - "//conditions:default": ["-pthread"], + "@platforms//os:qnx": [], + "@platforms//os:linux": ["-pthread"], }), linkopts = select({ - "//config:build_qnx8": [], - "//config:x86_64-qnx": [], - "//conditions:default": [ + "@platforms//os:qnx": [], + "@platforms//os:linux": [ "-lpthread", "-lrt", ], @@ -42,14 +40,12 @@ cc_binary( "control_daemon.cpp", ], copts = select({ - "//config:build_qnx8": [], - "//config:x86_64-qnx": [], - "//conditions:default": ["-pthread"], + "@platforms//os:qnx": [], + "@platforms//os:linux": ["-pthread"], }), linkopts = select({ - "//config:build_qnx8": [], - "//config:x86_64-qnx": [], - "//conditions:default": [ + "@platforms//os:qnx": [], + "@platforms//os:linux": [ "-lpthread", "-lrt", ], diff --git a/examples/cpp_lifecycle_app/BUILD b/examples/cpp_lifecycle_app/BUILD index 40f35d03..b10152c9 100644 --- a/examples/cpp_lifecycle_app/BUILD +++ b/examples/cpp_lifecycle_app/BUILD @@ -16,14 +16,12 @@ cc_binary( "main.cpp", ], copts = select({ - "//config:build_qnx8": [], - "//config:x86_64-qnx": [], - "//conditions:default": ["-pthread"], + "@platforms//os:qnx": [], + "@platforms//os:linux": ["-pthread"], }), linkopts = select({ - "//config:build_qnx8": [], - "//config:x86_64-qnx": [], - "//conditions:default": ["-lpthread"], + "@platforms//os:qnx": [], + "@platforms//os:linux": ["-lpthread"], }), visibility = ["//visibility:public"], deps = [ diff --git a/examples/cpp_supervised_app/BUILD b/examples/cpp_supervised_app/BUILD index 2a59b1bd..654f841c 100644 --- a/examples/cpp_supervised_app/BUILD +++ b/examples/cpp_supervised_app/BUILD @@ -17,13 +17,13 @@ cc_binary( ], copts = select({ "@platforms//os:qnx": [], - "//conditions:default": ["-pthread"], + "@platforms//os:linux": [], }), linkopts = select({ "@platforms//os:qnx": [ "-lsocket", ], - "//conditions:default": [ + "@platforms//os:linux": [ "-lpthread", "-lrt", ], diff --git a/examples/demo_recording.mp4 b/examples/demo_recording.mp4 deleted file mode 100644 index 05bc688f..00000000 Binary files a/examples/demo_recording.mp4 and /dev/null differ diff --git a/examples/demo_setup1.png b/examples/demo_setup1.png deleted file mode 100644 index f5448805..00000000 Binary files a/examples/demo_setup1.png and /dev/null differ diff --git a/examples/demo_setup2.png b/examples/demo_setup2.png deleted file mode 100644 index 25658eb1..00000000 Binary files a/examples/demo_setup2.png and /dev/null differ diff --git a/examples/run.sh b/examples/run.sh index f5526c6b..dd704251 100755 --- a/examples/run.sh +++ b/examples/run.sh @@ -23,7 +23,6 @@ file_exists() { fi } - LM_BINARY="$PWD/../bazel-bin/src/launch_manager_daemon/launch_manager" DEMO_APP_BINARY="$PWD/../bazel-bin/examples/cpp_supervised_app/cpp_supervised_app" DEMO_APP_WO_HM_BINARY="$PWD/../bazel-bin/examples/cpp_lifecycle_app/cpp_lifecycle_app" @@ -41,7 +40,7 @@ file_exists $CONTROL_CLI_BINARY NUMBER_OF_CPP_PROCESSES_PER_PROCESS_GROUP=1 NUMBER_OF_RUST_PROCESSES_PER_PROCESS_GROUP=1 NUMBER_OF_NON_SUPERVISED_CPP_PROCESSES_PER_PROCESS_GROUP=1 -PROCESS_GROUPS="--process_groups MainPG" +PROCESS_GROUPS="--process_groups MainPG ProcessGroup1" rm -rf tmp rm -rf config/tmp diff --git a/examples/rust_supervised_app/BUILD b/examples/rust_supervised_app/BUILD index 98b070ad..6cb6b38b 100644 --- a/examples/rust_supervised_app/BUILD +++ b/examples/rust_supervised_app/BUILD @@ -28,7 +28,7 @@ rust_binary( "@platforms//os:qnx": [ "-Clink-arg=-lc++", ], - "//conditions:default": [ + "@platforms//os:linux": [ "-Clink-arg=-lrt", "-Clink-arg=-lstdc++", ], diff --git a/externals/ipc_dropin/include/ipc_dropin/socket.hpp b/externals/ipc_dropin/include/ipc_dropin/socket.hpp index 982dd393..051ad8f4 100644 --- a/externals/ipc_dropin/include/ipc_dropin/socket.hpp +++ b/externals/ipc_dropin/include/ipc_dropin/socket.hpp @@ -32,7 +32,11 @@ namespace ipc_dropin ReturnCode create(const char *name, mode_t mode) { name_ = name; - fd_ = shm_open(name, O_CREAT | O_RDWR | O_CLOEXEC, mode); + if(name_.size() > 0 && name_[0] != '/') { + name_ = "/" + name_; + } + + fd_ = shm_open(name_.c_str(), O_CREAT | O_RDWR | O_CLOEXEC, mode); if (fd_ < 0) { if (errno == EACCES) @@ -70,7 +74,11 @@ namespace ipc_dropin ReturnCode connect(const char *name) noexcept { name_ = name; - fd_ = shm_open(name, O_RDWR | O_CLOEXEC, 0); + if(name_.size() > 0 && name_[0] != '/') { + name_ = "/" + name_; + } + + fd_ = shm_open(name_.c_str(), O_RDWR | O_CLOEXEC, 0); if (fd_ < 0) { if (errno == EACCES) @@ -216,4 +224,4 @@ namespace ipc_dropin } -#endif \ No newline at end of file +#endif diff --git a/src/health_monitoring_lib/BUILD b/src/health_monitoring_lib/BUILD index 88bbe6cb..926b588d 100644 --- a/src/health_monitoring_lib/BUILD +++ b/src/health_monitoring_lib/BUILD @@ -106,7 +106,7 @@ rust_test( "@platforms//os:qnx": [ "-Clink-arg=-lc++", ], - "//conditions:default": [ + "@platforms//os:linux": [ "-Clink-arg=-lrt", "-Clink-arg=-lstdc++", ], @@ -124,7 +124,7 @@ cc_gtest_unit_test( ], linkopts = select({ "@platforms//os:qnx": ["-lsocket"], - "//conditions:default": [], + "@platforms//os:linux": [], }), deps = [ ":health_monitoring_lib_cc_stub_supervisor", diff --git a/src/launch_manager_daemon/BUILD b/src/launch_manager_daemon/BUILD index a18d5545..2b0d0d83 100644 --- a/src/launch_manager_daemon/BUILD +++ b/src/launch_manager_daemon/BUILD @@ -12,6 +12,12 @@ # ******************************************************************************* load("//config:common_cc.bzl", "cc_binary_with_common_opts", "cc_library_with_common_opts") +filegroup( + name = "lm_flatcfg_fbs", + srcs = ["config/lm_flatcfg.fbs"], + visibility = ["//visibility:public"], +) + cc_library( name = "config", hdrs = ["config/lm_flatcfg_generated.h"], @@ -29,9 +35,8 @@ cc_binary_with_common_opts( ), includes = ["src/"], linkopts = select({ - "//config:x86_64-qnx": ["-lsecpol"], - "//config:build_qnx8": ["-lsecpol"], - "//conditions:default": ["-lpthread"], + "@platforms//os:qnx": ["-lsecpol"], + "@platforms//os:linux": ["-lpthread"], }), visibility = ["//visibility:public"], deps = [ diff --git a/src/launch_manager_daemon/common/BUILD b/src/launch_manager_daemon/common/BUILD index 187f7672..dd71a42c 100644 --- a/src/launch_manager_daemon/common/BUILD +++ b/src/launch_manager_daemon/common/BUILD @@ -57,7 +57,7 @@ cc_library( cc_library( name = "osal", srcs = select({ - "//config:x86_64-qnx": glob( + "@platforms//os:qnx": glob( [ "src/internal/osal/**/*.cpp", ], @@ -65,15 +65,7 @@ cc_library( "src/internal/osal/linux/**", ], ), - "//config:build_qnx8": glob( - [ - "src/internal/osal/**/*.cpp", - ], - exclude = [ - "src/internal/osal/linux/**", - ], - ), - "//conditions:default": glob( + "@platforms//os:linux": glob( [ "src/internal/osal/**/*.cpp", ], diff --git a/src/launch_manager_daemon/health_monitor_lib/BUILD b/src/launch_manager_daemon/health_monitor_lib/BUILD index 3f699d3c..783c6117 100644 --- a/src/launch_manager_daemon/health_monitor_lib/BUILD +++ b/src/launch_manager_daemon/health_monitor_lib/BUILD @@ -12,6 +12,18 @@ # ******************************************************************************* load("//config:common_cc.bzl", "cc_binary_with_common_opts", "cc_library_with_common_opts") +filegroup( + name = "hm_flatcfg_fbs", + srcs = ["config/hm_flatcfg.fbs"], + visibility = ["//visibility:public"], +) + +filegroup( + name = "hmcore_flatcfg_fbs", + srcs = ["config/hmcore_flatcfg.fbs"], + visibility = ["//visibility:public"], +) + # flatcfg configuration cc_library( name = "config", @@ -151,9 +163,8 @@ cc_library_with_common_opts( "@flatbuffers", ] + select( { - "//config:build_qnx8": [], - "//config:x86_64-qnx": [], - "//conditions:default": [ + "@platforms//os:qnx": [], + "@platforms//os:linux": [ "//externals/acl", ], }, @@ -178,9 +189,8 @@ cc_library_with_common_opts( "//src/launch_manager_daemon/process_state_client_lib:process_state_client", ] + select( { - "//config:build_qnx8": [], - "//config:x86_64-qnx": [], - "//conditions:default": [ + "@platforms//os:qnx": [], + "@platforms//os:linux": [ "//externals/acl", ], }, @@ -239,9 +249,8 @@ cc_library_with_common_opts( "@flatbuffers//:flatc", ] + select( { - "//config:build_qnx8": [], - "//config:x86_64-qnx": [], - "//conditions:default": [ + "@platforms//os:qnx": [], + "@platforms//os:linux": [ "//externals/acl", ], }, diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/PhmDaemon.hpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/PhmDaemon.hpp index 7728155d..08e4e69f 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/PhmDaemon.hpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/PhmDaemon.hpp @@ -172,9 +172,6 @@ class PhmDaemon #ifdef LAUNCH_MANAGER_ALIVE_SUPERVISION processStateReader.distributeExmActivation(startTimestamp); -#else - logger_r.LogWarn() << "Phm Daemon: LM Alive supervision is not activated, since LM does not yet support " - "checkpoint reporting."; #endif while (!f_terminateCond.load()) diff --git a/src/launch_manager_daemon/lifecycle_client_lib/BUILD b/src/launch_manager_daemon/lifecycle_client_lib/BUILD index d4f91cb6..3daa5c38 100644 --- a/src/launch_manager_daemon/lifecycle_client_lib/BUILD +++ b/src/launch_manager_daemon/lifecycle_client_lib/BUILD @@ -23,15 +23,13 @@ cc_library( "include/score/lcm/lifecycle_client.h", ], copts = select({ - "//config:x86_64-qnx": [], - "//config:build_qnx8": [], - "//conditions:default": ["-pthread"], + "@platforms//os:qnx": [], + "@platforms//os:linux": ["-pthread"], }), includes = ["include"], linkopts = select({ - "//config:x86_64-qnx": [], - "//config:build_qnx8": [], - "//conditions:default": ["-lpthread"], + "@platforms//os:qnx": [], + "@platforms//os:linux": ["-lpthread"], }), visibility = ["//visibility:public"], deps = [ diff --git a/src/lifecycle_client_lib/BUILD b/src/lifecycle_client_lib/BUILD index 9e312a89..2ab049b5 100644 --- a/src/lifecycle_client_lib/BUILD +++ b/src/lifecycle_client_lib/BUILD @@ -35,14 +35,12 @@ cc_library( "include/runapplication.h", ], copts = select({ - "//config:x86_64-qnx": [], - "//config:build_qnx8": [], - "//conditions:default": ["-pthread"], + "@platforms//os:qnx": [], + "@platforms//os:linux": ["-pthread"], }), linkopts = select({ - "//config:x86_64-qnx": [], - "//config:build_qnx8": [], - "//conditions:default": ["-lpthread"], + "@platforms//os:qnx": [], + "@platforms//os:linux": ["-lpthread"], }), visibility = ["//visibility:public"], deps = [