Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 6.1.2rc2
    • Fix Version/s: 6.1.2
    • Component/s: NIO
    • Labels:
      None
    • Environment:
      JDK 1.6.0_01, Solaris 9
    • Number of attachments :
      0

      Description

      I am seeing responses that contain fragments from previous response buffers prepended to the correct response. I set a breakpoint in HttpGenerator.completeHeader() to see if the result of _buffers.getBuffer() was a non-empty, and it intermittently returns a buffer that has a non-zero length(). It turns out that something is causing the same buffer to be returned to the buffer pool multiple times. I added some logging to getBuffer/returnBuffer to look for mismatched calls. In my application I observed the following sequence of returnBuffer calls without an intervening getBuffer call. It appears the HttpGenerator.reset() is being called in a way that is not thread-safe.

      INFO   | jvm 1    | 2007/04/18 18:12:12 | 2007-04-18 18:12:12.203::WARN:  returnBuffer returns 2356633: len=0
      INFO   | jvm 1    | 2007/04/18 18:12:12 | java.lang.Exception
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.AbstractBuffers.returnBuffer(AbstractBuffers.java:150)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.AbstractGenerator.reset(AbstractGenerator.java:153)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.HttpGenerator.reset(HttpGenerator.java:78)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.HttpConnection.reset(HttpConnection.java:435)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:416)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:365)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |
      INFO   | jvm 1    | 2007/04/18 18:12:12 | 2007-04-18 18:12:12.203::WARN:  returnBuffer returns 2356633: len=0
      INFO   | jvm 1    | 2007/04/18 18:12:12 | java.lang.Exception
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.AbstractBuffers.returnBuffer(AbstractBuffers.java:150)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.AbstractGenerator.reset(AbstractGenerator.java:153)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.HttpGenerator.reset(HttpGenerator.java:78)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.HttpConnection.destroy(HttpConnection.java:125)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.AbstractConnector.connectionClosed(AbstractConnector.java:737)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.nio.SelectChannelConnector.access$100(SelectChannelConnector.java:64)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.nio.SelectChannelConnector$1.endPointClosed(SelectChannelConnector.java:92)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.io.nio.SelectChannelEndPoint.doUpdateKey(SelectChannelEndPoint.java:352)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.io.nio.SelectorManager$SelectSet.doSelect(SelectorManager.java:347)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.io.nio.SelectorManager.doSelect(SelectorManager.java:175)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.nio.SelectChannelConnector.accept(SelectChannelConnector.java:124)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.jetty.AbstractConnector$Acceptor.run(AbstractConnector.java:500)
      INFO   | jvm 1    | 2007/04/18 18:12:12 |       at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
      
      

        Activity

        Hide
        Greg Wilkins added a comment -

        Ah yes - I saw this issue some time ago when you get sockets being closed at the same time as the response is sent.
        you end up with double resets.

        I protected the HttpParser.reset() method but stupidly left HttpGenerator unprotected!

        I believe it is fixed in SVN head now.... but I don't have a test harness that can reproduce this....

        Show
        Greg Wilkins added a comment - Ah yes - I saw this issue some time ago when you get sockets being closed at the same time as the response is sent. you end up with double resets. I protected the HttpParser.reset() method but stupidly left HttpGenerator unprotected! I believe it is fixed in SVN head now.... but I don't have a test harness that can reproduce this....
        Greg Wilkins made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Fix Version/s 6.1.2 [ 13311 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        Scott Stanton added a comment -

        My test case passes now. I think this issue is resolve. Thanks for the quick turnaround!

        Show
        Scott Stanton added a comment - My test case passes now. I think this issue is resolve. Thanks for the quick turnaround!

          People

          • Assignee:
            Unassigned
            Reporter:
            Scott Stanton
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: