tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41361] New: - Content lost when read by a slow client.
Date Sun, 14 Jan 2007 20:10:01 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41361>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41361

           Summary: Content lost when read by a slow client.
           Product: Tomcat 5
           Version: 5.5.20
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: c.varney@alchemy.co.nz


Given the following servlet:

public class GreetingServlet extends HttpServlet
{
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException
  {
    PrintWriter printWriter = response.getWriter();

    for (int i = 0; i < 10000; i++)
    {
      printWriter.println("Servlet test................ Line: " + i);

      if (printWriter.checkError())  // this causes a flush
      {
        System.err.println("An error occurred, " + i + " lines written.");
      }
    }

    printWriter.close();
  }
}



Only the first 4328 rows are available for the following client to read:

  public void testHTTPRead() throws Exception
  {

    URL url = new URL("http://localhost:/servlettest/test");
    URLConnection conn = url.openConnection();
    InputStream inputStream = conn.getInputStream();

    // Note these timings are sensitive - invoking inputStream.available()
    // each second for 50 times and all the content can be read.
    for (int i = 0; i < 5; i++)
    {
      System.out.println(inputStream.available());
      Thread.sleep(10000);
    }

    InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
    BufferedReader in = new BufferedReader(inputStreamReader);

    String str;
    while ((str = in.readLine()) != null)
    {
      System.out.println(inputStream.available() + " " + str);
    }

  }


This may be related to bug 37627.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message