beagle r4730 - in trunk/beagle/beagled: . IndexHelper



Author: dbera
Date: Tue Apr 22 21:38:25 2008
New Revision: 4730
URL: http://svn.gnome.org/viewvc/beagle?rev=4730&view=rev

Log:
Workaround for bnc #381928 and bgo #529262 (beagled unkillable after crash part). Remove mono's sigabrt handler if not run with --mono-debug. Users loose pretty(!) stacktrace when beagled crashes in some native library but beagled is guaranteed to die in such cases and not remain an Resident-Evil zombie.


Modified:
   trunk/beagle/beagled/BeagleDaemon.cs
   trunk/beagle/beagled/IndexHelper/IndexHelper.cs
   trunk/beagle/beagled/Shutdown.cs

Modified: trunk/beagle/beagled/BeagleDaemon.cs
==============================================================================
--- trunk/beagle/beagled/BeagleDaemon.cs	(original)
+++ trunk/beagle/beagled/BeagleDaemon.cs	Tue Apr 22 21:38:25 2008
@@ -571,6 +571,13 @@
 
 			// Ignore SIGPIPE
 			Mono.Unix.Native.Stdlib.signal (Mono.Unix.Native.Signum.SIGPIPE, Mono.Unix.Native.Stdlib.SIG_IGN);
+
+			// Work around a mono feature/bug
+			// https://bugzilla.novell.com/show_bug.cgi?id=381928
+			// When beagle crashes, mono will try to print a stack trace and then call abort()
+			// The abort somehow calls back into beagle and causes a deadlock
+			if (Environment.GetEnvironmentVariable ("BEAGLE_MONO_DEBUG_FLAG_IS_SET") == null)
+				Mono.Unix.Native.Stdlib.signal (Mono.Unix.Native.Signum.SIGABRT, Mono.Unix.Native.Stdlib.SIG_DFL);
 		}
 
 		// Mono signal handler allows setting of global variables;

Modified: trunk/beagle/beagled/IndexHelper/IndexHelper.cs
==============================================================================
--- trunk/beagle/beagled/IndexHelper/IndexHelper.cs	(original)
+++ trunk/beagle/beagled/IndexHelper/IndexHelper.cs	Tue Apr 22 21:38:25 2008
@@ -298,6 +298,13 @@
 
 			// Ignore SIGPIPE
 			Mono.Unix.Native.Stdlib.signal (Mono.Unix.Native.Signum.SIGPIPE, Mono.Unix.Native.Stdlib.SIG_IGN);
+
+			// Work around a mono feature/bug
+			// https://bugzilla.novell.com/show_bug.cgi?id=381928
+			// When beagle crashes, mono will try to print a stack trace and then call abort()
+			// The abort somehow calls back into beagle and causes a deadlock
+			if (Environment.GetEnvironmentVariable ("BEAGLE_MONO_DEBUG_FLAG_IS_SET") == null)
+				Mono.Unix.Native.Stdlib.signal (Mono.Unix.Native.Signum.SIGABRT, Mono.Unix.Native.Stdlib.SIG_DFL);
 		}
 
 		private static void OurSignalHandler (int signal)

Modified: trunk/beagle/beagled/Shutdown.cs
==============================================================================
--- trunk/beagle/beagled/Shutdown.cs	(original)
+++ trunk/beagle/beagled/Shutdown.cs	Tue Apr 22 21:38:25 2008
@@ -187,6 +187,13 @@
 			// FIXME: Shouldn't this be done in every thread ?
 			Mono.Unix.Native.Stdlib.SetSignalAction (Mono.Unix.Native.Signum.SIGPIPE, Mono.Unix.Native.SignalAction.Ignore);
 
+			// Work around a mono feature/bug
+			// https://bugzilla.novell.com/show_bug.cgi?id=381928
+			// When beagle crashes, mono will try to print a stack trace and then call abort()
+			// The abort somehow calls back into beagle and causes a deadlock
+			if (Environment.GetEnvironmentVariable ("BEAGLE_MONO_DEBUG_FLAG_IS_SET") == null)
+				Mono.Unix.Native.Stdlib.SetSignalAction (Mono.Unix.Native.Signum.SIGABRT, Mono.Unix.Native.SignalAction.Default);
+
 			Thread signal_thread = new Thread (delegate () {
 				Log.Debug ("Starting signal handler thread");
 				int signal_handler_timeout = -1;



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