I have a question, I looked at the code for Response.java,
it seems that even if the Request and Response objects have been recycled, the ResponseFacade is allowed a reference all the way down to the output buffer. If this output buffer happens to be reused somewhere, for a different socket, we are now writing to the wrong browser.

In Response.java we have the following code:
  public void recycle() {

       outputBuffer.recycle();
       usingOutputStream = false;
       usingWriter = false;
       appCommitted = false;
       included = false;
       error = false;
       isCharacterEncodingSet = false;
cookies.clear();

       if (Constants.SECURITY) {
           if (facade != null) {
facade.clear(); //why does this only happen when the security manager is enabled?
               facade = null;
           }
           if (outputStream != null) {
               outputStream.clear();
               outputStream = null;
           }
           if (writer != null) {
               writer.clear();
               writer = null;
           }
       } else {
           writer.recycle();
       }

   }

would anyone want to explain why the facacde.clear() would only be called by with the security manager turned on, The result of the reference still being valid, can appear when an error happens on incoming chunked data on a second or third comet request, and since the comet still has the reference, it can still try to write, and in this case, the socket not being available yields the error,
but the byte buffer is filled up.

java.lang.NullPointerException
at org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:723) at org.apache.coyote.http11.InternalNioOutputBuffer.flush(InternalNioOutputBuffer.java:290) at org.apache.coyote.http11.Http11NioProcessor.action(Http11NioProcessor.java:1015)
   at org.apache.coyote.Response.action(Response.java:182)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:294) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:268)
   at org.apache.catalina.connector.Response.flushBuffer(Response.java:530)
at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:277) at org.hanik.comet.test.TestCometServlet$MyCometThread.run(TestCometServlet.java:88)

I'm looking to be enlightened....

thanks
Filip


java.lang.NullPointerException (the blocking http connection)
at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:772) at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:123) at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:579)
   at org.apache.coyote.Response.doWrite(Response.java:559)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:333)
   at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:433)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:289) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:268)
   at org.apache.catalina.connector.Response.flushBuffer(Response.java:530)
at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:277) at org.hanik.comet.test.TestCometServlet$MyCometThread.run(TestCometServlet.java:84)


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to