Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
7.6
-
None
-
None
Description
LBHttpSolrClient.java needs to be fixed , as if the doRequest (called by request method below) method throws exception, the for loop will get terminated and the request will fail
public Rsp request(Req req) throws SolrServerException, IOException {
Rsp rsp = new Rsp();
Exception ex = null;
boolean isNonRetryable = req.request instanceof IsUpdateRequest ||
ADMIN_PATHS.contains(req.request.getPath());
List<ServerWrapper> skipped = null;
final Integer numServersToTry = req.getNumServersToTry();
int numServersTried = 0;
boolean timeAllowedExceeded = false;
long timeAllowedNano = getTimeAllowedInNanos(req.getRequest());
long timeOutTime = System.nanoTime() + timeAllowedNano;
for (String serverStr : req.getServers()) {
if (timeAllowedExceeded = isTimeExceeded(timeAllowedNano,
timeOutTime))
serverStr = normalize(serverStr);
// if the server is currently a zombie, just skip to the next one
ServerWrapper wrapper = zombieServers.get(serverStr);
if (wrapper != null) {
// System.out.println("ZOMBIE SERVER QUERIED: " + serverStr);
final int numDeadServersToTry = req.getNumDeadServersToTry();
if (numDeadServersToTry > 0) {
if (skipped == null)
else if (skipped.size() < numDeadServersToTry)
{ skipped.add(wrapper); } }
continue;
}
try {
MDC.put("LBHttpSolrClient.url", serverStr);
if (numServersToTry != null && numServersTried >
numServersToTry.intValue())
HttpSolrClient client = makeSolrClient(serverStr);
++numServersTried;
ex = doRequest(client, req, rsp, isNonRetryable, false, null);
if (ex == null) { return rsp; // SUCCESS }
} finally { MDC.remove("LBHttpSolrClient.url"); }
}
// try the servers we previously skipped
if (skipped != null)
if (numServersToTry != null && numServersTried >
numServersToTry.intValue())
{ break; }
try {
MDC.put("LBHttpSolrClient.url", wrapper.client.getBaseURL());
++numServersTried;
ex = doRequest(wrapper.client, req, rsp, isNonRetryable, true,
wrapper.getKey());
if (ex == null)
} finally
{ MDC.remove("LBHttpSolrClient.url"); } }
}
final String solrServerExceptionMessage;
if (timeAllowedExceeded)
else {
if (numServersToTry != null && numServersTried >
numServersToTry.intValue())
else
{ solrServerExceptionMessage = "No live SolrServers available to handle this request"; } }
if (ex == null)
else
{ throw new SolrServerException(solrServerExceptionMessage+":" + zombieServers.keySet(), ex); }
}