[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Freeipa-devel] [PATCH][SSSD] Fix bug where services restarted by the monitor would be pinged more than once per cycle



Whenever a service is started by the monitor, we start a series of timed
events to poll the child service for responsiveness every N seconds.
However, when a dead process is restarted, we weren't terminating the
original polling, so each time a process died, we were adding another
ping to the event loop, causing a resource leak.

This patch allows us to store the current event_timer for the ping in
the service object, so we can destroy it when restarting a service.
-- 
Stephen Gallagher
RHCE 804006346421761

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
From 28522f8a6a17719f50393e36ac2d88fabcefa4fb Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh redhat com>
Date: Fri, 27 Mar 2009 07:26:27 -0400
Subject: [PATCH] Fix bug where services restarted by the monitor would be pinged more than once per cycle

---
 server/monitor/monitor.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c
index 0ee344c..9320ed8 100644
--- a/server/monitor/monitor.c
+++ b/server/monitor/monitor.c
@@ -64,6 +64,8 @@ struct mt_svc {
     time_t last_pong;
 
     int debug_level;
+
+    struct tevent_timer *ping_ev;
 };
 
 struct mt_ctx {
@@ -192,6 +194,11 @@ static void svc_try_restart(struct mt_svc *svc, time_t now)
         return;
     }
 
+    /* Shut down the current ping timer so it will restart
+     * cleanly in start_service()
+     */
+    talloc_free(svc->ping_ev);
+
     ret = start_service(svc);
     if (ret != EOK) {
         DEBUG(0,("Failed to restart service '%s'\n", svc->name));
@@ -286,6 +293,7 @@ static void set_tasks_checker(struct mt_svc *svc)
                   svc->name));
         /* FIXME: shutdown ? */
     }
+    svc->ping_ev = te;
 }
 
 static void global_checks_handler(struct tevent_context *ev,
-- 
1.6.0.6

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]