24662cf7d67a02bc0a1dab62b3be93cdc97eb800 hiram Mon Apr 5 12:42:49 2021 -0700 improving errro messages in case of dynamic server overload refs #26658 diff --git src/hg/hgBlat/hgBlat.c src/hg/hgBlat/hgBlat.c index 72f7778..32bbb3b 100644 --- src/hg/hgBlat/hgBlat.c +++ src/hg/hgBlat/hgBlat.c @@ -28,30 +28,31 @@ #include "hgConfig.h" #include "errCatch.h" #include "portable.h" #include "portable.h" #include "dystring.h" #include "chromInfo.h" #include "net.h" #include "fuzzyFind.h" struct cart *cart; /* The user's ui state. */ struct hash *oldVars = NULL; boolean orgChange = FALSE; boolean dbChange = FALSE; boolean allGenomes = FALSE; boolean allResults = FALSE; +static long enteredMainTime = 0; struct gfResult /* Detailed gfServer results, this is a span of several nearby tiles, minimum 2 for dna. */ { struct gfResult *next; /* have to multiply translated coordinates by 3 */ int qStart; /* Query Start Coordinate */ int qEnd; /* Query End Coordinate */ char *chrom; /* Target Chrom Name */ int tStart; /* Target Start Coordinate */ int tEnd; /* Target End Coordinate */ int numHits; /* number of tile hits, minimum 2 for dna */ char tStrand; /* + or - Target Strand used with prot, rnax, dnax */ int tFrame; /* Target Frame 0,1,2 (mostly ignorable?) used with prot, rnax, dnax */ @@ -1378,32 +1379,48 @@ int ret = 0; /* Put together command. */ gfBeginRequest(conn); if (serve->isDynamic) sprintf(buf, "%s%s %s %s", gfSignature(), (serve->isTrans ? "transInfo" : "untransInfo"), conn->genome, conn->genomeDataDir); else sprintf(buf, "%sstatus", gfSignature()); mustWriteFd(conn->fd, buf, strlen(buf)); for (;;) { if (netGetString(conn->fd, buf) == NULL) { - warn("Error reading status information from %s:%s; gfServer maybe down or misconfigured, see system logs for details", + long et = clock1000() - enteredMainTime; + if (serve->isDynamic) + { + if (et > 110000) + warn("the dynamic blat service is taking too long to respond, probably overloaded at this time, try again later. Error reading status information from %s:%s", + serve->host, serve->port); + else if (et < 500) + warn("the dynamic blat service is returning an error immediately. it is probably overloaded at this time, try again later. Error reading status information from %s:%s", + serve->host, serve->port); + else + warn("the dynamic blat service is returning an error at this time, try again later. Error reading status information from %s:%s", serve->host, serve->port); + } + else + { + warn("Error reading status information from %s:%s; gfServer maybe down or misconfigured, see system logs for details)", + serve->host, serve->port); + } ret = -1; break; } if (sameString(buf, "end")) break; else { if (startsWith("tileSize ", buf)) { serve->tileSize = atoi(buf+strlen("tileSize ")); } if (startsWith("stepSize ", buf)) { serve->stepSize = atoi(buf+strlen("stepSize ")); } @@ -2320,26 +2337,26 @@ cartWebEnd(); } else blatSeq(skipLeadingSpaces(userSeq), organism, db, 0); } } /* Null terminated list of CGI Variables we don't want to save * permanently. */ char *excludeVars[] = {"Submit", "submit", "Clear", "Lucky", "type", "userSeq", "seqFile", "showPage", "changeInfo", NULL}; int main(int argc, char *argv[]) /* Process command line. */ { -long enteredMainTime = clock1000(); +enteredMainTime = clock1000(); oldVars = hashNew(10); cgiSpoof(&argc, argv); /* org has precedence over db when changeInfo='orgChange' */ cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars); cgiExitTime("hgBlat", enteredMainTime); return 0; }