eclipse-bluechi / bluechi

Eclipse BlueChi is a systemd service controller intended for multi-node environments with a predefined number of nodes and with a focus on highly regulated ecosystems such as those requiring functional safety.
https://bluechi.readthedocs.io/en/latest/
GNU Lesser General Public License v2.1
130 stars 37 forks source link

controller: Proactively disconnect node based on heartbeat #911

Closed dofmind closed 2 months ago

dofmind commented 2 months ago

This PR is an update of https://github.com/eclipse-bluechi/bluechi/pull/870

The main difference is that the code is simplified by using microseconds in last_seen instead of the struct timespec. It updates last_seen in node_method_register() to prevent the node disconnecting right now when last_seen is 0 or too old. Additionally, it handles disconnected nodes by calling node_disconnected() instead of controller_remove_node(). Otherwise an error will occur.

bluechi-controller: ../git/src/controller/node.c:123: unit_subscriptions_clear: Assertion `LIST_IS_EMPTY(usubs->subs)' failed.

Fixes: https://github.com/eclipse-bluechi/bluechi/issues/857

coveralls commented 2 months ago

Coverage Status

coverage: 84.541% (-0.6%) from 85.15% when pulling 64025ba70a687f0eb50c006dc7cab593c95420f7 on dofmind:controller-heartbeat into af1dcfe34e8ecd9a758ef878043b2e6c83ce0dd5 on eclipse-bluechi:main.

coveralls commented 2 months ago

Coverage Status

coverage: 84.854% (-0.3%) from 85.15% when pulling 0157cdc360d6e09b619e12a6ec7927ea43a2ca27 on dofmind:controller-heartbeat into af1dcfe34e8ecd9a758ef878043b2e6c83ce0dd5 on eclipse-bluechi:main.

coveralls commented 2 months ago

Coverage Status

coverage: 85.154% (+0.004%) from 85.15% when pulling a278805dd03c8ac391285cb2a91709410e56c02f on dofmind:controller-heartbeat into af1dcfe34e8ecd9a758ef878043b2e6c83ce0dd5 on eclipse-bluechi:main.

coveralls commented 2 months ago

Coverage Status

coverage: 85.154% (+0.004%) from 85.15% when pulling 37269b6dc8bb68ff17be184f58006f0b967a98a1 on dofmind:controller-heartbeat into af1dcfe34e8ecd9a758ef878043b2e6c83ce0dd5 on eclipse-bluechi:main.

engelmi commented 2 months ago

LGTM and thanks for adding tests!

@dofmind Could you add the two new configuration options to the bluechi-controller.conf.5.md? Sorry, I missed that during the previous review. Then, I think, the PR is ready to merge.

dofmind commented 2 months ago

@dofmind Could you add the two new configuration options to the bluechi-controller.conf.5.md? Sorry, I missed that during the previous review. Then, I think, the PR is ready to merge.

This PR already has them. Did I miss anything?

engelmi commented 2 months ago

@dofmind Could you add the two new configuration options to the bluechi-controller.conf.5.md? Sorry, I missed that during the previous review. Then, I think, the PR is ready to merge.

This PR already has them. Did I miss anything?

No, but I did. Sorry about that.