ca7d7a6ad69056034c50055a4baa31466c1f04e4
galt
  Wed Jun 26 17:35:06 2013 -0700
fixing dumpstack to use _exit instead of exit so that the child cleanup will not close the mysql connections that are shared with the parent process.
diff --git src/hg/lib/jksql.c src/hg/lib/jksql.c
index db359fa..7a25c57 100644
--- src/hg/lib/jksql.c
+++ src/hg/lib/jksql.c
@@ -905,31 +905,31 @@
 
 // additional check finds errors of multiple NOSQLINJ tags
 if (strstr(query, "NOSQLINJ "))
     {
     sqlCheckError("Oops, multiple occurrences of NOSQLINJ tag in query: %s", query);
     query = replaceChars(query, "NOSQLINJ ", "");
     fixedMultipleNOSQLINJ = TRUE;
     }
 
 monitorEnter();
 if (mysql_real_query(conn, query, strlen(query)) != 0)
     {
     if (abort)
         {
         monitorLeave();
-	dumpStack("oops DEBUG"); // DEBUG REMOVE
+	dumpStack("DEBUG Can't start query"); // Extra debugging info. DEBUG REMOVE
 	sqlAbort(sc, "Can't start query:\n%s\n", query);
         }
     }
 else
     {
     MYSQL_RES *resSet;
     if ((resSet = getter(conn)) == NULL)
 	{
 	if (mysql_errno(conn) != 0)
 	    {
             monitorLeave();
 	    sqlAbort(sc, "Can't use query:\n%s", query);
 	    }
 	}
     else
@@ -2786,30 +2786,31 @@
 	{
 	// DEBUG REMOVE Temporary for trying to track down some weird error 
 	//  because the stackdump should appear but does not.
 	//dumpStack("character %c disallowed in sql string part %s\n", c, sOriginal);  // DEBUG REMOVE GALT 
 
 	// TODO for some reason the warn stack is messed up sometimes very eary. -- happening in hgTables position search on brca
 	//warn("character %c disallowed in sql string part %s", c, sOriginal);
 
 	// DEBUG REMOVE GALT 
 	// just using this as a work-around
 	// until the problem with early errors and warn/abort stacks has been fixed.
 	char *noSqlInjLevel = cfgOption("noSqlInj.level");
 	if (noSqlInjLevel && !sameString(noSqlInjLevel, "ignore"))
 	    {
     	    fprintf(stderr, "character %c disallowed in sql string part %s\n", c, sOriginal);  
+	    fflush(stderr);
 	    }
 
 	return FALSE;
 	}
     }
 return TRUE;
 }
 
 static void sqlCheckDisallowAllChars(char disAllowed[256])
 /* Disallow all chars by setting to 1 */
 {
 int i;
 for(i=0;i<256;++i)
     disAllowed[i] = 1;
 }
@@ -3432,30 +3433,32 @@
 	    || endsWith(scriptName, "hgSuggest")
            ) // note: this doesn't work for hgSuggest because it doesn't set the dumpStack handler.
                // TODO find or add a better method to tell if it would already dumpStack on abort.
        )
         */
 	{
 	va_list dump_args;
     	va_copy(dump_args, args);
 	vaDumpStack(format, dump_args);
 	va_end(dump_args);
 	}
 
     if (sameString(noSqlInjLevel, "logOnly"))
 	{
 	vfprintf(stderr, format, args);
+	fprintf(stderr, "\n");
+	fflush(stderr);
 	}
 
     if (sameString(noSqlInjLevel, "warn"))
 	{
 	vaWarn(format, args);
 	}
 
     if (sameString(noSqlInjLevel, "abort"))
 	{
 	vaErrAbort(format, args);
 	}
     }
 
 va_end(args);