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)
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
- relates to
-
JDK-8005306 Redundant cast warning in KeepAliveStream.java
- Closed