[ 
https://issues.apache.org/jira/browse/SOLR-13481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16858071#comment-16858071
 ] 

David Smiley commented on SOLR-13481:
-------------------------------------

I don't recommend pasting in lots of code into the description of a Jira issue. 
 Instead I recommend using a durable link to the code to a particular line, 
like at GitHub.  Can you fix it accordingly please?

Also, comment how this problem surfaced for you or perhaps how to reproduce 
it... or is the more theoretical?

(p.s. I'm not volunteering to fix the issue but wanted to help you report the 
issue better)

> Re-try of solr request will not happen with different live servers, if one 
> request throws Exception
> ---------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-13481
>                 URL: https://issues.apache.org/jira/browse/SOLR-13481
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: clients - java
>    Affects Versions: 7.6
>            Reporter: Rajeswari Natarajan
>            Priority: Major
>
> 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))
> {          break;        }
>  
>         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)
> {              skipped = new ArrayList<>(numDeadServersToTry);              
> skipped.add(wrapper);            }
>            else if (skipped.size() < numDeadServersToTry)
> {              skipped.add(wrapper);            }
>          }
>           continue;
>         }
>         try {
>           MDC.put("LBHttpSolrClient.url", serverStr);
>   
>           if (numServersToTry != null && numServersTried >
>  numServersToTry.intValue())
> {            break;          }
>   
>           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) {
>         for (ServerWrapper wrapper : skipped) \{          if 
> (timeAllowedExceeded = isTimeExceeded(timeAllowedNano, timeOutTime)) \{       
>      break;          }
>  
>   
>           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)
> {              return rsp; // SUCCESS            }
>          } finally
> {            MDC.remove("LBHttpSolrClient.url");          }
>        }
>       }
>   
>   
>       final String solrServerExceptionMessage;
>       if (timeAllowedExceeded)
> {        solrServerExceptionMessage = "Time allowed to handle this request 
> exceeded";      }
> else {
>         if (numServersToTry != null && numServersTried >
>  numServersToTry.intValue())
> {          solrServerExceptionMessage = "No live SolrServers available to 
> handle this request:"              + " numServersTried="+numServersTried      
>         + " numServersToTry="+numServersToTry.intValue();        }
> else
> {          solrServerExceptionMessage = "No live SolrServers available to 
> handle this request";        }
>      }
>       if (ex == null)
> {        throw new SolrServerException(solrServerExceptionMessage);      }
> else
> {        throw new SolrServerException(solrServerExceptionMessage+":" + 
> zombieServers.keySet(), ex);      }
>  
>     }



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to