Hi,

I have detected what seems to be a bug in the recycle logic
of TomCat 3.2.1. What seems to be happening is, that a
response object of some kind is using a Writer and processes
the request. In some other request the BufferedServletOutputStream's
"usingWriter" flag is still set, in other words, the recycling
doesn't seem to work properly.

I can demonstrate the problem and create a workaround by
adding the following code on top of my servlet. It uses
a method isUsingWriter(), which I have added to the
BufferedServletOutputStream class:


    ServletOutputStream os = pRes.getOutputStream();
    if (os instanceof org.apache.tomcat.core.BufferedServletOutputStream) {
      org.apache.tomcat.core.BufferedServletOutputStream bsos =
        (org.apache.tomcat.core.BufferedServletOutputStream) os;
      if (bsos.isUsingWriter()) {
        Trace.Log(this, "tmGet", 5, "OutputStream is using Writer");
        bsos.setUsingWriter(false);
      }
    }

Reply via email to