svn rev #22055: tools/gssmonger/trunk/ gssmaggot/ gssmaster/

raeburn@MIT.EDU raeburn at MIT.EDU
Wed Feb 25 14:33:18 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22055
Commit By: raeburn
Log Message:
Don't install a signal handler for ^C on UNIX; it's likely to lead to
a deadlock in the current UNIX logging code because of the use of
mutexes.

Disable some of the printf calls in the networking code.

Log source file and line number when making a log entry; currently it
looks like the best way to correlate log output with tests in the
sources.

Log some info when creating a new logging block or finishing one.
Properly pass back the handle on the new block to the caller.



Changed Files:
U   tools/gssmonger/trunk/gssmaggot/netutil.c
U   tools/gssmonger/trunk/gssmaster/clientio.c
U   tools/gssmonger/trunk/gssmaster/ezlog_log4cpp.cpp
U   tools/gssmonger/trunk/gssmaster/main.c
Modified: tools/gssmonger/trunk/gssmaggot/netutil.c
===================================================================
--- tools/gssmonger/trunk/gssmaggot/netutil.c	2009-02-25 16:47:43 UTC (rev 22054)
+++ tools/gssmonger/trunk/gssmaggot/netutil.c	2009-02-25 19:33:17 UTC (rev 22055)
@@ -223,7 +223,9 @@
 
     ULONG i;
 
+#ifdef DEBUG
     printf( "NetReadInteger: (size: %lu)\n", pEntry->ulSize );
+#endif
 
     if ( !NetReadExactly( sock,
                           pEntry->pvData,
@@ -295,7 +297,9 @@
           ret && ( i < cEntries );
           i ++ ) {
 
+#ifdef DEBUG
       printf ( "NetReadArgArray: waiting for entry %ld of %ld (%hs) on %ld...\n", i, cEntries, pEntries[i].Name, (long) sock );
+#endif
       GsmDebug( DBG_NETIO,
                 "NetReadArgArray: waiting for entry %ld (%hs)...\n",
                 i,

Modified: tools/gssmonger/trunk/gssmaster/clientio.c
===================================================================
--- tools/gssmonger/trunk/gssmaster/clientio.c	2009-02-25 16:47:43 UTC (rev 22054)
+++ tools/gssmonger/trunk/gssmaster/clientio.c	2009-02-25 19:33:17 UTC (rev 22055)
@@ -321,7 +321,9 @@
 
     ulMsgId = htonl( MessageId );
 
+#ifdef DEBUG
     printf( "ClientSendReceiveData: (%s) %lu %lu [%lu]\n", MessageName, cInputParams, cOutputParams, (unsigned long) sizeof( ulMsgId ) );
+#endif
 
 
     GsmDebug( DBG_NETIO,

Modified: tools/gssmonger/trunk/gssmaster/ezlog_log4cpp.cpp
===================================================================
--- tools/gssmonger/trunk/gssmaster/ezlog_log4cpp.cpp	2009-02-25 16:47:43 UTC (rev 22054)
+++ tools/gssmonger/trunk/gssmaster/ezlog_log4cpp.cpp	2009-02-25 19:33:17 UTC (rev 22055)
@@ -169,7 +169,7 @@
   va_start(args, LogString);
   vsnprintf(ProcessedLogString, 4096, LogString, args);
   va_end(args);
-	
+
   char LogName[24];
   snprintf(LogName, 24, "gssMonger.%ld", BlockCounter);
   
@@ -178,12 +178,20 @@
   cat->setAppender(app);
   cat->setAppender(appConsole);
 
+  ezLogMsg(EZLOG_BLOCK, EZ_DEFAULT, "StartBlock %p from %p(%s)",
+	   (void *)cat,
+	   OldLevel,
+	   (OldLevel
+	    ? ((Category *)OldLevel)->getName().data()
+	    : "?"));
+
   cat->log(etol_priority(LogLevel),
 	   ProcessedLogString);
 
   BlockCounter++;
 
-  NewLevel = (void**)cat;
+  if (NewLevel)
+      *NewLevel = (void*)cat;
 
   return TRUE;
 }
@@ -209,14 +217,19 @@
 		    IN va_list * ExtraArgs) {
 
   if (cat == NULL) {
-    void** temp;
-    ezStartBlock( NULL, temp, 0, LogLevel, "Autoinitializing log..." );
+    void* temp;
+    ezStartBlock( NULL, &temp, 0, LogLevel, "Autoinitializing log..." );
   }
   
   char ProcessedLogString[4096];
   va_list * args = ExtraArgs;
-  
-  vsnprintf(ProcessedLogString, 4096, LogString, *args);
+
+  snprintf(ProcessedLogString, sizeof(ProcessedLogString),
+	   "%s:%lu ", File, Line);
+
+  vsnprintf(ProcessedLogString + strlen(ProcessedLogString),
+	    sizeof(ProcessedLogString) - strlen(ProcessedLogString),
+	    LogString, *args);
   va_end(*args);
 
   cat->log(etol_priority(LogLevel),
@@ -239,6 +252,8 @@
 
 // Close the specified log4cpp log
 EZLOGAPI ezFinishBlock( IN OPTIONAL HANDLE handle ) {
+    ezLogMsg(EZLOG_BLOCK, EZ_DEFAULT, "FinishBlock %p(%s)", handle,
+	     ((Category *)handle)->getName().data());
   Category::shutdown();
   cat = NULL;
 }

Modified: tools/gssmonger/trunk/gssmaster/main.c
===================================================================
--- tools/gssmonger/trunk/gssmaster/main.c	2009-02-25 16:47:43 UTC (rev 22054)
+++ tools/gssmonger/trunk/gssmaster/main.c	2009-02-25 19:33:17 UTC (rev 22055)
@@ -610,13 +610,18 @@
       goto cleanup;
     }
 
-    #ifdef WINNT
-	    SetConsoleCtrlHandler( Control_C_Callback,
-    	                       TRUE /* add */ );
-  	#else
-	  	signal(SIGINT, Control_C_Callback_UNIXWrapper);                         
-	#endif
-	
+#ifdef WINNT
+    SetConsoleCtrlHandler( Control_C_Callback,
+			   TRUE /* add */ );
+#else
+#if 0 /* The signal handler function calls into the logging code.  So,
+	 in fact, does a static destructor.  The logging code is using
+	 a mutex, so invoking any of that stuff on SIGINT can cause
+	 a deadlock.  Just let ^C kill the process for now.  */
+    signal(SIGINT, Control_C_Callback_UNIXWrapper);
+#endif
+#endif
+
     if ( PrintTestNames ) {
 
       ezLogMsgA( EZLOG_INFO,
@@ -734,6 +739,17 @@
     
     Control_C_Callback( 0 );
 
+#ifndef _WIN32 /* On UNIX at least, we're using a mutex in the logging
+		  code, so calling into it in Control_C_Callback could
+		  result in deadlock.  */
+
+    // BUGBUG: should send close-notification to slaves.
+
+    /* Don't destroy the logging thread.  Exit rudely. */
+    
+    ezCloseLog( EZCLOSELOG_FULL_FILE_REPORT );
+#endif
+
     return 0;
 
 }




More information about the cvs-krb5 mailing list