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

HttpSolrClient.createMethod does not handle both stream and large data

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 6.6.2, 7.4
    • Fix Version/s: None
    • Component/s: SolrJ
    • Labels:
      None

      Description

      When using a ContentStreamUpdateRequest with stream data (through addContentStream()), all other parameters are passed on the URL, leading to the server failing with "URI is too large".

      The code below provokes the error using Solrj 7.4, but was first seen on Solr 6.6.2. The problem is in HttpSolrClient.createMethod(), where the presence of stream data leads to all other fields being put on the URL

      Example code

      String stringValue = StringUtils.repeat('X', 16*1024);
      
      SolrClient solr = new HttpSolrClient.Builder(BASE_URL).build();
      
      ContentStreamUpdateRequest updateRequest = new ContentStreamUpdateRequest("/update/extract");
      updateRequest.setParam("literal.id", "UriTooLargeTest-simpleTest");
      updateRequest.setParam("literal.field", stringValue);
      updateRequest.addContentStream(new ContentStreamBase.StringStream(stringValue));
      
      updateRequest.process(solr);
      

      The client sees the following error:

      org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://server/solr/core: Expected mime type application/octet-stream but got text/html. <h1>Bad Message 414</h1><pre>reason: URI Too Long</pre>
      

      Error fragment from HttpSolrClient.createMethod

            if(contentWriter != null) {
              String fullQueryUrl = url + wparams.toQueryString();
              HttpEntityEnclosingRequestBase postOrPut = SolrRequest.METHOD.POST == request.getMethod() ?
                  new HttpPost(fullQueryUrl) : new HttpPut(fullQueryUrl);
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              elygre Eirik Lygre
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: