[CalendarServer-changes] [2351] CalendarServer/branches/users/wsanchez/logging/twistedcaldav/tap.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 25 17:24:43 PDT 2008


Revision: 2351
          http://trac.macosforge.org/projects/calendarserver/changeset/2351
Author:   wsanchez at apple.com
Date:     2008-04-25 17:24:43 -0700 (Fri, 25 Apr 2008)

Log Message:
-----------
SIGHUP causes config.reload()

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/logging/twistedcaldav/tap.py

Modified: CalendarServer/branches/users/wsanchez/logging/twistedcaldav/tap.py
===================================================================
--- CalendarServer/branches/users/wsanchez/logging/twistedcaldav/tap.py	2008-04-26 00:23:44 UTC (rev 2350)
+++ CalendarServer/branches/users/wsanchez/logging/twistedcaldav/tap.py	2008-04-26 00:24:43 UTC (rev 2351)
@@ -739,14 +739,12 @@
             service = serviceMethod(options)
 
             #
-            # Temporary hack to work around SIGHUP problem
-            # If there is a stopped process in the same session as the
-            # calendar server and the calendar server is the group
-            # leader then when twistd forks to drop privelages a
-            # SIGHUP may be sent by the kernel. This SIGHUP should be
+            # Note: if there is a stopped process in the same session
+            # as the calendar server and the calendar server is the
+            # group leader then when twistd forks to drop privileges a
+            # SIGHUP may be sent by the kernel, which can cause the
+            # process to exit. This SIGHUP should be, at a minimum,
             # ignored.
-            # Note that this handler is not unset, so any further
-            # SIGHUPs are also ignored.
             #
 
             def location(frame):
@@ -755,13 +753,15 @@
                 else:
                     return "%s: %s" % (frame.f_code.co_name, frame.f_lineno)
 
-            # FIXME: SIGHUP should cause us to reload the config file
+            import signal
+            def sighup_handler(num, frame):
+                log.error("SIGHUP recieved at %s" % (location(frame),))
 
-            #import signal
-            #def sighup_handler(num, frame):
-            #    log.debug("SIGHUP recieved at %s" % (location(frame),))
-            #signal.signal(signal.SIGHUP, sighup_handler)
+                # Reload the config file
+                config.reload()
 
+            signal.signal(signal.SIGHUP, sighup_handler)
+
             #def sigusr1_handler(num, frame):
             #    log.debug("SIGUSR1 recieved at %s" % (location(frame),))
             #signal.signal(signal.SIGUSR1, sigusr1_handler)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080425/18f58ad2/attachment.html


More information about the calendarserver-changes mailing list