[CalendarServer-changes] [1184] CalendarServer/branches/users/tfitz/log-alot-128-2/twistedcaldav/tap .py

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 13 16:25:36 PST 2007


Revision: 1184
          http://trac.macosforge.org/projects/calendarserver/changeset/1184
Author:   tfitz at apple.com
Date:     2007-02-13 16:25:36 -0800 (Tue, 13 Feb 2007)

Log Message:
-----------
Move the signal handler to a better place.

Modified Paths:
--------------
    CalendarServer/branches/users/tfitz/log-alot-128-2/twistedcaldav/tap.py

Modified: CalendarServer/branches/users/tfitz/log-alot-128-2/twistedcaldav/tap.py
===================================================================
--- CalendarServer/branches/users/tfitz/log-alot-128-2/twistedcaldav/tap.py	2007-02-13 21:54:58 UTC (rev 1183)
+++ CalendarServer/branches/users/tfitz/log-alot-128-2/twistedcaldav/tap.py	2007-02-14 00:25:36 UTC (rev 1184)
@@ -390,16 +390,6 @@
                     interface=bindAddress
                     )
                 httpsService.setServiceParent(service)
-
-        import signal
-        def sighup_handler(num, frame):
-            if frame is None:
-                location = "Unknown"
-            else:
-	        location = str(frame.f_code.co_name) + ": " + str(frame.f_lineno)
-            log.msg("SIGHUP recieved at " + location)
-
-        signal.signal(signal.SIGHUP, sighup_handler)
             
         return service
 
@@ -420,7 +410,20 @@
                  "multiprocess, master, slave" % (serverType,)))
 
         else:
-            return serviceMethod(options)
+            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 ignored.
+            # Note that this handler is not unset, so any further SIGHUPs are also ignored.
+            import signal
+            def sighup_handler(num, frame):
+                if frame is None:
+                    location = "Unknown"
+                else:
+                    location = str(frame.f_code.co_name) + ": " + str(frame.f_lineno)
+                log.msg("SIGHUP recieved at " + location)
+            signal.signal(signal.SIGHUP, sighup_handler)
 
-                                
+            return service                    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070213/457f11c7/attachment.html


More information about the calendarserver-changes mailing list