Solr
  1. Solr
  2. SOLR-2535

REGRESSION: in Solr 3.x and trunk the admin/file handler fails to show directory listings

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1, 3.2, 4.0-ALPHA
    • Fix Version/s: 3.4, 4.0-ALPHA
    • Labels:
      None
    • Environment:

      java 1.6, jetty

      Description

      In Solr 1.4.1, going to the path solr/admin/file I see an XML-formatted listing of the conf directory, like:

      <response>
      <lst name="responseHeader"><int name="status">0</int><int name="QTime">1</int></lst>
      <lst name="files">
        <lst name="elevate.xml"><long name="size">1274</long><date name="modified">2011-03-06T20:42:54Z</date></lst>
        ...
      </lst>
      </response>
      

      I can list the xslt sub-dir using solr/admin/files?file=/xslt

      In Solr 3.1.0, both of these fail with a 500 error:

      HTTP ERROR 500
      
      Problem accessing /solr/admin/file/. Reason:
      
          did not find a CONTENT object
      
      java.io.IOException: did not find a CONTENT object
      

      Looking at the code in class ShowFileRequestHandler, it seem like 3.1.0 should still handle directory listings if not file name is given, or if the file is a directory, so I am filing this as a bug.

      1. SOLR-2535-post-SOLR-2452.patch
        7 kB
        Erick Erickson
      2. SOLR-2535.patch
        7 kB
        Peter Wolanin
      3. SOLR-2535_fix_admin_file_handler_for_directory_listings.patch
        10 kB
        David Smiley

        Activity

        Hide
        Stefan Matheis (steffkes) added a comment -

        Same for trunk

        $ svn info
        Path: .
        URL: https://svn.apache.org/repos/asf/lucene/dev/trunk/solr
        Repository Root: https://svn.apache.org/repos/asf
        Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
        Revision: 1130610
        Node Kind: directory
        Schedule: normal
        Last Changed Author: rmuir
        Last Changed Rev: 1130527
        Last Changed Date: 2011-06-02 14:58:22 +0200 (Thu, 02 Jun 2011)

        Stacktrace:

        INFO: [] webapp=/solr path=/admin/file params={} status=0 QTime=7
        Jun 2, 2011 5:49:29 PM org.apache.solr.common.SolrException log
        SEVERE: java.io.IOException: did not find a CONTENT object
                at org.apache.solr.response.RawResponseWriter.write(RawResponseWriter.java:113)
                at org.apache.solr.servlet.SolrDispatchFilter.writeResponse(SolrDispatchFilter.java:333)
                at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:261)
                at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
                at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
                at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
                at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
                at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
                at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
                at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
                at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
                at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
                at org.mortbay.jetty.Server.handle(Server.java:326)
                at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
                at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
                at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
                at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
                at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
                at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
                at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
        Show
        Stefan Matheis (steffkes) added a comment - Same for trunk $ svn info Path: . URL: https: //svn.apache.org/repos/asf/lucene/dev/trunk/solr Repository Root: https: //svn.apache.org/repos/asf Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68 Revision: 1130610 Node Kind: directory Schedule: normal Last Changed Author: rmuir Last Changed Rev: 1130527 Last Changed Date: 2011-06-02 14:58:22 +0200 (Thu, 02 Jun 2011) Stacktrace: INFO: [] webapp=/solr path=/admin/file params={} status=0 QTime=7 Jun 2, 2011 5:49:29 PM org.apache.solr.common.SolrException log SEVERE: java.io.IOException: did not find a CONTENT object at org.apache.solr.response.RawResponseWriter.write(RawResponseWriter.java:113) at org.apache.solr.servlet.SolrDispatchFilter.writeResponse(SolrDispatchFilter.java:333) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:261) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
        Hide
        Robert Muir added a comment -

        Bulk move 3.2 -> 3.3

        Show
        Robert Muir added a comment - Bulk move 3.2 -> 3.3
        Hide
        Peter Wolanin added a comment -

        This ought to be a trivial fix, so I hope we can get it in 3.1.1, or is 3.3 going to be the next minor version?

        Show
        Peter Wolanin added a comment - This ought to be a trivial fix, so I hope we can get it in 3.1.1, or is 3.3 going to be the next minor version?
        Hide
        David Smiley added a comment -

        The attached patch fixes this bug and adds new tests for a directory listing and getting a file. This bug was triggered with the introduction of SOLR-2263 in which RawResponseWriter was changed to implement BinaryQueryResponseWriter. This wasn't a problem in and of itself, but the SolrDispatchFilter checks if a response writer is the binary variant and if so calls the write(OutputStream...) variant. But the responses from ShowFileRequestHandler that list directory contents are incompatible with the RawResponseWriter if RawResponseWriter's write(OutputStream...) method is uses, instead of a character based stream. The solution was to move the defaulting of the "raw" response type from ShowFileRequestHandler.init() into into a condition within handleRequestBody() where it knows the response is a file.

        Show
        David Smiley added a comment - The attached patch fixes this bug and adds new tests for a directory listing and getting a file. This bug was triggered with the introduction of SOLR-2263 in which RawResponseWriter was changed to implement BinaryQueryResponseWriter. This wasn't a problem in and of itself, but the SolrDispatchFilter checks if a response writer is the binary variant and if so calls the write(OutputStream...) variant. But the responses from ShowFileRequestHandler that list directory contents are incompatible with the RawResponseWriter if RawResponseWriter's write(OutputStream...) method is uses, instead of a character based stream. The solution was to move the defaulting of the "raw" response type from ShowFileRequestHandler.init() into into a condition within handleRequestBody() where it knows the response is a file.
        Hide
        Peter Wolanin added a comment -

        Thanks for the patch. Is every thing in there related to this bug? Some of it looks like other cleanup.

        Show
        Peter Wolanin added a comment - Thanks for the patch. Is every thing in there related to this bug? Some of it looks like other cleanup.
        Hide
        David Smiley added a comment -

        The relayout of import statements in SolrDisptatchFilter.java is inadvertent.
        The QueryRequest.java one-liner was a null-check that I felt was an improvement so that I didn't have to pass in an empty params list to QueryRequest's constructor.

        Show
        David Smiley added a comment - The relayout of import statements in SolrDisptatchFilter.java is inadvertent. The QueryRequest.java one-liner was a null-check that I felt was an improvement so that I didn't have to pass in an empty params list to QueryRequest's constructor.
        Hide
        Peter Wolanin added a comment -

        Quick test works - patched the 3.2 source and rebuilding the directory and subdirctory listings work as expected.

        The patch I used is the same as David's but just re-rolled without the changes to SolrDisptatchFilter.java

        I'm trying to attach it, but jira is throwing a stack trace.

        Show
        Peter Wolanin added a comment - Quick test works - patched the 3.2 source and rebuilding the directory and subdirctory listings work as expected. The patch I used is the same as David's but just re-rolled without the changes to SolrDisptatchFilter.java I'm trying to attach it, but jira is throwing a stack trace.
        Hide
        Steve Rowe added a comment -

        I'm trying to attach it, but jira is throwing a stack trace.

        I mentioned this problem on #asfinfra an hour or so ago - medthomas has tracked down the problem, to the ASF JIRA plugin needing to be updated for the just-upgraded JIRA instance, and he's working on fixing the problem.

        Show
        Steve Rowe added a comment - I'm trying to attach it, but jira is throwing a stack trace. I mentioned this problem on #asfinfra an hour or so ago - medthomas has tracked down the problem, to the ASF JIRA plugin needing to be updated for the just-upgraded JIRA instance, and he's working on fixing the problem.
        Hide
        Peter Wolanin added a comment -

        Here's the patch I used. As before, it's just David's with the extra changes omitted.

        Show
        Peter Wolanin added a comment - Here's the patch I used. As before, it's just David's with the extra changes omitted.
        Hide
        Erick Erickson added a comment -

        OK, I've applied the patch to both 3x and trunk and it looks good. If nobody objects I'll commit this Monday.

        Show
        Erick Erickson added a comment - OK, I've applied the patch to both 3x and trunk and it looks good. If nobody objects I'll commit this Monday.
        Hide
        Simon Willnauer added a comment -

        OK, I've applied the patch to both 3x and trunk and it looks good. If nobody objects I'll commit this Monday.

        don't wait too long, no need to wait until monday.

        Show
        Simon Willnauer added a comment - OK, I've applied the patch to both 3x and trunk and it looks good. If nobody objects I'll commit this Monday. don't wait too long, no need to wait until monday.
        Hide
        Yonik Seeley added a comment -

        don't wait too long, no need to wait until monday.

        +1, commit it now!

        Esp for a bug fix, unless one thinks there is something likely controversial about it, or one is unsure about something and is thus requesting feedback.

        Show
        Yonik Seeley added a comment - don't wait too long, no need to wait until monday. +1, commit it now! Esp for a bug fix, unless one thinks there is something likely controversial about it, or one is unsure about something and is thus requesting feedback.
        Hide
        Mark Miller added a comment -

        If nobody objects I'll commit this Monday.

        +1

        Show
        Mark Miller added a comment - If nobody objects I'll commit this Monday. +1
        Hide
        Erick Erickson added a comment -

        I'm just waiting for the recent code reorganization to get back to 3x to make this easier on myself, especially the merge step. I could have two patches, but it seems like the code reorg is hard enough as it is, making additional changes in the underlying 3x code base would just add useless complexity.

        But I'm willing to be convinced otherwise.

        Show
        Erick Erickson added a comment - I'm just waiting for the recent code reorganization to get back to 3x to make this easier on myself, especially the merge step. I could have two patches, but it seems like the code reorg is hard enough as it is, making additional changes in the underlying 3x code base would just add useless complexity. But I'm willing to be convinced otherwise.
        Hide
        Steve Rowe added a comment -

        I'm just waiting for the recent code reorganization to get back to 3x

        I'm working on it! Hopefully finished today or tomorrow.

        Show
        Steve Rowe added a comment - I'm just waiting for the recent code reorganization to get back to 3x I'm working on it! Hopefully finished today or tomorrow.
        Hide
        Erick Erickson added a comment -

        No problem, man! I'm just happy you're doing the work on the reorg instead of me....

        Show
        Erick Erickson added a comment - No problem, man! I'm just happy you're doing the work on the reorg instead of me....
        Hide
        Erick Erickson added a comment -

        Patch to reflect relocated code.

        Show
        Erick Erickson added a comment - Patch to reflect relocated code.
        Hide
        Erick Erickson added a comment -

        trunk rev: 1146685
        branch 3x rev: 1146806

        Thanks David and Peter!

        Show
        Erick Erickson added a comment - trunk rev: 1146685 branch 3x rev: 1146806 Thanks David and Peter!
        Hide
        Steve Rowe added a comment -

        Jenkins is reporting that branch_3x solr/src/test compilation is failing after this issue was committed.

        I've opened SOLR-2653 to address the problem.

        Show
        Steve Rowe added a comment - Jenkins is reporting that branch_3x solr/src/test compilation is failing after this issue was committed. I've opened SOLR-2653 to address the problem.
        Hide
        Robert Muir added a comment -

        bulk close for 3.4

        Show
        Robert Muir added a comment - bulk close for 3.4

          People

          • Assignee:
            Erick Erickson
            Reporter:
            Peter Wolanin
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development