harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vasily Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3703) [classlib][archive][netbeans] GZIPInputStream throws IOException when feeding from the network
Date Thu, 26 Apr 2007 02:57:15 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491869
] 

Vasily Zakharov commented on HARMONY-3703:
------------------------------------------

I've noticed that IBM VM in some cases "swallows" the unexpected exception diagnostic and
terminates silently like everything is ok while in fact exception was thrown. Here's the updated
test that takes care of this issue:

public class Test {
    public static void main(String args[]) throws Exception {
        byte[] buffer = new byte[0x100000];
        String url =
                "http://www.netbeans.org/updates/55_1.20_.xml.gz";
                //"file:55_1.20_.xml.gz";
        java.io.InputStream stream = new java.util.zip.GZIPInputStream(new java.net.URL(url).openStream());
        int length = 0, num = 0;

        while (num >= 0) {
            System.out.println(length += num);
            try {
                num = stream.read(buffer, length, (buffer.length - length));
            } catch (Throwable t) {
                t.printStackTrace(System.out);
                System.out.println("FAIL");
                return;
            }
        }
        System.out.println("SUCCESS");
    }
}

I've run this test on my machine 1000 times on IBM VM with not a single SUCCESS. The following
FAILs were observed:

java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(System.java:327)
	at java.lang.System.arraycopy(System.java:237)
	at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:164)
	at Test.main(Test.java:13)
(655 times, size is negative)

java.io.EOFException
	at java.util.zip.GZIPInputStream.readFully(GZIPInputStream.java:196)
	at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:168)
	at Test.main(Test.java:13)
(302 times, size is 0, 1 or 2)

java.io.IOException: Crc mismatch
	at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:170)
	at Test.main(Test.java:13)
(43 times, size is 8)

It looks like the particular outcome depends on the particular value of size variable on each
run.


> [classlib][archive][netbeans] GZIPInputStream throws IOException when feeding from the
network
> ----------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3703
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3703
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>            Reporter: Vasily Zakharov
>
> When java.util.zip.GZIPInputStream is passed a stream constructed from a network URL,
it throws IOException (Crc mismatch) at end-of-stream. If the same content is fed through
local file URL, the problem doesn't occur. It looks like some end-of-stream detection problem
is in place, or a race condition.
> public class Test {
>     public static void main(String args[]) throws Exception {
>         byte[] buffer = new byte[0x100000];
>         String url =
>                 "http://www.netbeans.org/updates/55_1.20_.xml.gz";
>                 //"file:55_1.20_.xml.gz";
>         java.io.InputStream stream = new java.util.zip.GZIPInputStream(new java.net.URL(url).openStream());
>         int length = 0, num = 0;
>         while (num >= 0) {
>             length += num;
>             System.out.println(length);
>             num = stream.read(buffer, length, (buffer.length - length));
>         }
>     }
> }
> $ Ri/bin/java -Dhttp.proxyHost=$PROXY_HOST -Dhttp.proxyPort=$PROXY_PORT Test
> 0
> 777
> 3392
> ...
> 386431
> SUCCESS
> $ HY/bin/java -Dhttp.proxyHost=$PROXY_HOST -Dhttp.proxyPort=$PROXY_PORT Test
> 0
> 777
> 3392
> ...
> 386431
> Exception in thread "main" java.io.IOException: Crc mismatch
>         at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:166)
>         at Test.main(Test.java:13)
> On IBM VM, this result is stable. On DRLVM, the test sometimes (rarely) passes, and sometimes
(also rarely) another exception occurs instead of IOException:
> Uncaught exception in main:
> java.lang.ArrayIndexOutOfBoundsException: bad arrayCopy
>         at java.lang.VMMemoryManager.arrayCopy(VMMemoryManager.java)
>         at java.lang.System.arraycopy(System.java:86)
>         at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:161)
>         at Test.main(Test.java:13)
> If content is previously downloaded (wget http://www.netbeans.org/updates/55_1.20_.xml.gz)
and local file URL is used instead of network URL (comment line 5, uncomment line 6), output
on Harmony becomes identical to output on RI.
> This problem was discovered while trying to run NetBeans on Harmony. 
> Issue HARMONY-3702 was also filed while investigating this one.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message