5da4287b37fd90e1eb7f4c13e5dc8b8f49a07a00 galt Wed May 9 09:13:41 2012 -0700 adding lazarus keepalive call to prevent apoptosis from terminating a legitimately busy long-running process diff --git src/hg/lib/web.c src/hg/lib/web.c index 6aa827d..4622e13 100644 --- src/hg/lib/web.c +++ src/hg/lib/web.c @@ -931,34 +931,48 @@ 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; } static unsigned long expireSeconds = 0; +static boolean lazarus = FALSE; +void lazarusLives(unsigned long newExpireSeconds) +/* Long running process requests more time */ +{ +lazarus = TRUE; +expireSeconds = newExpireSeconds; +} + /* phoneHome business */ static void cgiApoptosis(int status) /* signal handler for SIGALRM for phoneHome function and CGI expiration */ { +if (lazarus) + { + (void) alarm(expireSeconds); /* CGI timeout */ + lazarus = FALSE; + return; + } if (expireSeconds > 0) { /* want to see this error message in the apache error_log also */ fprintf(stderr, "cgiApoptosis: %lu seconds\n", expireSeconds); /* most of our CGIs post a polite non-fatal message with this errAbort */ errAbort("procedures have exceeded timeout: %lu seconds, function has ended.\n", expireSeconds); } exit(0); } static void phoneHome() { static boolean beenHere = FALSE; if (beenHere) /* one at a time please */ return;