7c12afac3ea3c7e3d212faa3b7686bb808084398
hiram
  Wed Jun 1 13:34:52 2011 -0700
adding error message on actual apoptosis timeout exit
diff --git src/hg/lib/web.c src/hg/lib/web.c
index a9c381f..84642ad 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -1106,47 +1106,50 @@
 
 if ((retDb == NULL) || !hDbExists(retDb))
     {
     retDb = hDefaultDb();
     }
 
 /* If genomes don't match, then get the default db for that genome */
 if (differentWord(genome, hGenome(retDb)))
     {
     retDb = hDefaultDbForGenome(genome);
     }
 
 return retDb;
 }
 
+unsigned long expireSeconds = 0;
 /* phoneHome business */
 static void cgiApoptosis(int status)
 /* signal handler for SIGALRM for phoneHome function and CGI expiration */
 {
+if (expireSeconds > 0)
+    errAbort("cgiApoptosis: %lu seconds\n", expireSeconds);
 exit(0);
 }
 
 static void phoneHome()
 {
 static boolean beenHere = FALSE;
 if (beenHere)  /* one at a time please */
     return;
 beenHere = TRUE;
 
 char *expireTime = cfgOptionDefault("browser.cgiExpireMinutes", "20");
 unsigned expireMinutes = sqlUnsigned(expireTime);
-unsigned long expireSeconds = expireMinutes * 60;
+expireSeconds = expireMinutes * 60;
 
 char trashFile[PATH_LEN];
 safef(trashFile, sizeof(trashFile), "%s/registration.txt", trashDir());
 
 /* trashFile does not exist during command line execution */
 if(fileExists(trashFile))	/* update access time for trashFile */
     {
     struct utimbuf ut;
     struct stat mystat;
     ZeroVar(&mystat);
     if (stat(trashFile,&mystat)==0)
 	{
 	ut.actime = clock1();
 	ut.modtime = mystat.st_mtime;
 	}
@@ -1171,30 +1174,31 @@
     if (f)		/* rigamarole only if we can get a trash file */
 	{
 	time_t now = time(NULL);
 	char *localTime;
 	extern char *tzname[2];
 	struct tm *tm = localtime(&now);
 	localTime = sqlUnixTimeToDate(&now,FALSE); /* FALSE == localtime */
 	fprintf(f, "%s, %s, %s %s, %s\n", scriptName, ip, localTime,
 	    tm->tm_isdst ? tzname[1] : tzname[0], trashFile);
 	fclose(f);
 	chmod(trashFile, 0666);
 	pid_t pid0 = fork();
 	if (0 == pid0)	/* in child */
 	    {
 	    close(STDOUT_FILENO); /* do not hang up Apache finish for parent */
+	    expireSeconds = 0;	/* no error message from this exit */
 	    (void) signal(SIGALRM, cgiApoptosis);
 	    (void) alarm(6);	/* timeout here in 6 seconds */
 #include "versionInfo.h"
 	    char url[1024];
 	    safef(url, sizeof(url), "%s%s",
 	"http://genomewiki.ucsc.edu/cgi-bin/useCount?version=browser.v",
 		CGI_VERSION);
 
 	    /* 6 second alarm will exit this page fetch if it does not work */
 	    (void) htmlPageGetWithCookies(url, NULL); /* ignore return */
 
 	    exit(0);
 	    }	/* child of fork has done exit(0) normally or via alarm */
 	}		/* trash file open OK */
     if (expireSeconds > 0)