Solr
  1. Solr
  2. SOLR-7664

Solrj client throws ParseException("Illegal content type") when server returns "other http error" (here 413) with BinaryResponseParser

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.2
    • Fix Version/s: 5.3
    • Component/s: SolrJ
    • Labels:
      None

      Description

      We have a program that uses Solrj to index data. For some (irrelevant) reason, the server sometimes returns "413 FULL Head" with no Content-Type header. When that happens, the Solrj library fails.

      In HttpSolrClient.executeMethod, two things happen:

      If there is no processor, then a RemoteSolrException is thrown, which is good. Ref https://github.com/apache/lucene-solr/blob/lucene_solr_5_2_0/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java#L493.

      However, when there is a processor, the code tries to call ContentType.parse() with the returned ContentType, which is null. This method throws a ParseException("Illegal content type"), which propagates to the client. The cause of the error is very much hidden now. Ref https://github.com/apache/lucene-solr/blob/lucene_solr_5_2_0/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java#L513.

      It would be nice if the client would throw a RemoteSolrException in this case, too.

      1. SOLR-7664.patch
        0.7 kB
        Ramkumar Aiyengar

        Issue Links

          Activity

          Hide
          Eirik Lygre added a comment -
          Show
          Eirik Lygre added a comment - See also http://codingtricks.fidibuy.com/participant/join/54fce329b760506d5d9e7db3/Spring-Data-Solr-cannot-handle-long-queries for another user who experienced the same problem.
          Hide
          Shalin Shekhar Mangar added a comment -

          Interesting, I have seen the same error on our Jenkins box but haven't ever been able to reproduce e.g. https://builds.apache.org/job/Lucene-Solr-NightlyTests-trunk/708/

          Do you know why your program is sending a large URI or request headers?

          Show
          Shalin Shekhar Mangar added a comment - Interesting, I have seen the same error on our Jenkins box but haven't ever been able to reproduce e.g. https://builds.apache.org/job/Lucene-Solr-NightlyTests-trunk/708/ Do you know why your program is sending a large URI or request headers?
          Hide
          Hoss Man added a comment -

          Do you know why your program is sending a large URI or request headers?

          We should probably keep this issue focused on propagating the correct error code, and spin off discussion/diagnosing when/why a 413 is returned ino a distinct issue. (the first should be a fairly easy fix, the later could take a while)

          Show
          Hoss Man added a comment - Do you know why your program is sending a large URI or request headers? We should probably keep this issue focused on propagating the correct error code, and spin off discussion/diagnosing when/why a 413 is returned ino a distinct issue. (the first should be a fairly easy fix, the later could take a while)
          Hide
          Hoss Man added a comment -

          Ram seems to have identified the cause of the 413 in SOLR-7681, so please keep discussion here focused on fixing the client to better propogate the specifics of the error.

          Show
          Hoss Man added a comment - Ram seems to have identified the cause of the 413 in SOLR-7681 , so please keep discussion here focused on fixing the client to better propogate the specifics of the error.
          Hide
          Ramkumar Aiyengar added a comment -

          One line patch to fix this issue. I am no expert with this code, so opinions welcome, but doesn't look like this could do any harm..

          Show
          Ramkumar Aiyengar added a comment - One line patch to fix this issue. I am no expert with this code, so opinions welcome, but doesn't look like this could do any harm..
          Hide
          ASF subversion and git services added a comment -

          Commit 1687135 from Ramkumar Aiyengar in branch 'dev/trunk'
          [ https://svn.apache.org/r1687135 ]

          SOLR-7664: Throw correct exception (RemoteSolrException) on receiving a HTTP 413

          Show
          ASF subversion and git services added a comment - Commit 1687135 from Ramkumar Aiyengar in branch 'dev/trunk' [ https://svn.apache.org/r1687135 ] SOLR-7664 : Throw correct exception (RemoteSolrException) on receiving a HTTP 413
          Hide
          ASF subversion and git services added a comment -

          Commit 1687137 from Ramkumar Aiyengar in branch 'dev/branches/branch_5x'
          [ https://svn.apache.org/r1687137 ]

          SOLR-7664: Throw correct exception (RemoteSolrException) on receiving a HTTP 413

          Show
          ASF subversion and git services added a comment - Commit 1687137 from Ramkumar Aiyengar in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1687137 ] SOLR-7664 : Throw correct exception (RemoteSolrException) on receiving a HTTP 413
          Hide
          Ramkumar Aiyengar added a comment -

          Thanks Eirik!

          Show
          Ramkumar Aiyengar added a comment - Thanks Eirik!
          Hide
          Shalin Shekhar Mangar added a comment -

          Bulk close for 5.3.0 release

          Show
          Shalin Shekhar Mangar added a comment - Bulk close for 5.3.0 release

            People

            • Assignee:
              Ramkumar Aiyengar
              Reporter:
              Eirik Lygre
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development