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

[TESTBUG] sun/net/www/http/ChunkedOutputStream/checkError.java fails on some systems

XMLWordPrintable

    • b123
    • arm, ppc
    • linux

        TESTFAIL:sun/net/www/http/ChunkedOutputStream/checkError.java
        The test sun/net/www/http/ChunkedOutputStream/checkError.java was written to check the fix for JDK-5054016. It attempts to stream 1Mb of chunked data through an http connection to the server. The test expects that IOException was raised during 'write' operation when the server closes the connection. Both client and server work in one process in two different threads.

        When the test is running with option -Xcomp we receive the following output:

        gtee@emb-spb-imx53-hf-1:~$ $JAVA_HOME/bin/java -Xcomp -XX:+UseSerialGC -Dprofile.jre -cp JTwork/classes/sun/net/www/http/ChunkedOutputStream checkError
        HTTP-client>Starting default Http-server
        waiting server to be start
        assigning 1024 to the chunk length
        Server started
        sending 1048576 bytes
        Exception in thread "main" HTTP version: HTTP/1.1
        User-Agent: Java/1.8.0_06-ea
        Host: localhost:59534
        Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
        Connection: keep-alive
        Content-type: application/x-www-form-urlencoded
        Transfer-Encoding: chunked

        receiving data
        Server socket is closed
        java.lang.RuntimeException: Test Failed: haven't received the expected IOException
                at checkError.testExit(checkError.java:121)
                at checkError.main(checkError.java:115)


        With option -Xmixed:

        gtee@emb-spb-imx53-hf-1:~$ $JAVA_HOME/bin/java -Xmixed -XX:+UseSerialGC -Dprofile.jre -cp JTwork/classes/sun/net/www/http/ChunkedOutputStream checkError
        HTTP-client>Starting default Http-server
        waiting server to be start
        assigning 1024 to the chunk length
        Server started
        sending 1048576 bytes
        HTTP version: HTTP/1.1
        User-Agent: Java/1.8.0_06-ea
        Host: localhost:60668
        Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
        Connection: keep-alive
        Content-type: application/x-www-form-urlencoded
        Transfer-Encoding: chunked

        receiving data
        Server socket is closed
        TEST PASSED

        The current test implementation very depends on two unaccounted factors:
        1) size of underlying TCP buffers:
        # cat /proc/sys/net/ipv4/tcp_wmem
        4096 16384 4001344
        The maximum size of TCP buffer on the failed board is about 3.8Mb, that means 'write' operation in this test might not be blocked. Thus the client can easily write 1Mb to the server but it doesn't guarantee that something has been read on the server side.
        2) thread scheduler:
        It's not known how will cooperate client and server threads, the server thread may wake up to late when the client thread has finished its work.

        One of the solution could be adding Thread.sleep(50) after every 'write' operation. It should take a chance to the server thread to do some work. However, the main problem in the test is its design, testing of so simple functionality could be done without involving network and threading functionality.


              chegar Chris Hegarty
              dkononenko Denis Kononenko
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: