Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8004863

Infinite Loop in KeepAliveStream

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • None
    • core-libs
    • None
    • b71
    • Verified

    Description

      An infinite loop has been observed in jdk/src/share/classes/sun/net/www/http/KeepAliveStream.java

       85: if (nskip <= available()) {
       86: long n = 0;
       87: while (n < nskip) {
       88: nskip = nskip - n;
       89: n = skip(nskip);
       90: }

      If this stream is asynchronously closed (or perhaps, read, or skipped), then skip will always return 0 (see MeteredStream)

          public synchronized long skip(long n) throws IOException {

              // REMIND: what does skip do on EOF????
              if (closed) {
                  return 0;
              }

      and you can clearly see an infinite loop.

      Here's an infinite loop stack trace snippet (line numbers from openjdk6 sources)

       sun.net.www.http.KeepAliveStream.close(KeepAliveStream.java:93)
       java.io.FilterInputStream.close(FilterInputStream.java:172)
       sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.close(HttpURLConnection.java:2625)
       org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.close(Unknown Source)
       org.apache.xerces.impl.io.UTF8Reader.close(Unknown Source)
       org.apache.xerces.impl.XMLEntityManager.closeReaders(Unknown Source)
       org.apache.xerces.parsers.XML11Configuration.cleanup(Unknown Source)
       org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

      Attachments

        Issue Links

          Activity

            People

              chegar Chris Hegarty
              chegar Chris Hegarty
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: