Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-2466

CommonsHttpSolrServer will retry a query even if _maxRetries is 0

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.1, 3.1, 4.0-ALPHA
    • Fix Version/s: 3.2
    • Component/s: clients - java
    • Labels:
      None

      Description

      The HttpClient library used by CommonsHttpSolrServer will retry by default 3 times a request that failed on the server side, even if the _maxRetries field of CommonsHttpSolrServer is set to 0.
      The retry count should be managed in just one place and CommonsHttpSolrServer seems to be the right one.
      CommonsHttpSolrServer should override that HttpClient default to 0 retries, and manage the retry count with the value of the field _maxRetries.

      1. SOLR-2466.patch
        3 kB
        Yonik Seeley

        Activity

        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        Hmmm, that's interesting. Does anyone know why we (CommonsHttpSolrServer) do retries when HttpClient already does them? Is there an advantage to doing it ourselves?

        Show
        yseeley@gmail.com Yonik Seeley added a comment - Hmmm, that's interesting. Does anyone know why we (CommonsHttpSolrServer) do retries when HttpClient already does them? Is there an advantage to doing it ourselves?
        Hide
        tomasflobbe Tomás Fernández Löbbe added a comment -

        Not sure why Solr does it on CommonsHttpSolrServer. I do think is important to be able to specify the exact number of retries.

        Show
        tomasflobbe Tomás Fernández Löbbe added a comment - Not sure why Solr does it on CommonsHttpSolrServer. I do think is important to be able to specify the exact number of retries.
        Hide
        hossman Hoss Man added a comment -

        I haven't checked hte code but if i remember correctly (from another project) HttpClient and it's RetryHandler "hook" are only used when dealing with network failures – ie: connection refused, connection timeout, connection aborted. If a request is a success at the TCP layer, but a failure at the HTTP layer (ie: 500) then you need your own retry logic external to the HttpClient

        that may be what SolrJ is doing, to account for transient errors (ie: trying to add during a blocking commit or something like that)

        Show
        hossman Hoss Man added a comment - I haven't checked hte code but if i remember correctly (from another project) HttpClient and it's RetryHandler "hook" are only used when dealing with network failures – ie: connection refused, connection timeout, connection aborted. If a request is a success at the TCP layer, but a failure at the HTTP layer (ie: 500) then you need your own retry logic external to the HttpClient that may be what SolrJ is doing, to account for transient errors (ie: trying to add during a blocking commit or something like that)
        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        Here's a patch that sets retry to 0 in HttpClient and lets SolrJ to the retry based on it's count.

        Show
        yseeley@gmail.com Yonik Seeley added a comment - Here's a patch that sets retry to 0 in HttpClient and lets SolrJ to the retry based on it's count.
        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        committed to 3x and trunk.

        Show
        yseeley@gmail.com Yonik Seeley added a comment - committed to 3x and trunk.
        Hide
        rcmuir Robert Muir added a comment -

        Bulk close for 3.2

        Show
        rcmuir Robert Muir added a comment - Bulk close for 3.2

          People

          • Assignee:
            Unassigned
            Reporter:
            tomasflobbe Tomás Fernández Löbbe
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development