[lttng-dev] [PATCH lttng-tools] Fix: health check and time

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue Jul 24 14:16:29 EDT 2012


* David Goulet (dgoulet at efficios.com) wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> I've just notice something here during testing.
> 
> Refer to the comment below.
> 
[...]
> I think this should "goto end" and NOT followed by an update to the
> last counter and time since this makes two health_check return
> respectively BAD and OK.
> 
> Considering two health check made by let say two applications or/and
> users, the second one will indicate a good health which is not true.
> 
> Cheers!
> David

How about the following fix ?

Fix: set health to bad state for good when error state detected

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
diff --git a/src/bin/lttng-sessiond/health.c b/src/bin/lttng-sessiond/health.c
index 7bf41c8..3637225 100644
--- a/src/bin/lttng-sessiond/health.c
+++ b/src/bin/lttng-sessiond/health.c
@@ -114,6 +114,7 @@ int health_check_state(struct health_state *state)
 		if (time_diff_gt(&current_time, &state->last_time, &time_delta)) {
 			if (current == last && !HEALTH_IS_IN_POLL(current)) {
 				/* error */
+				uatomic_or(&state->flags, HEALTH_ERROR);
 				retval = 0;
 			}
 			/* update last counter and last sample time */

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list