HttpURLConnection.getInputStream sends POST request after failed chunked send

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 7
    • Affects Version/s: 6u5, 6u23
    • Component/s: core-libs
    • b114
    • generic
    • generic, linux_redhat_5.2
    • Verified

        If a HttpURLConnection is using either fixed content length or chunked transfer to POST request body and for some reason the OutputStream throws an IOException while writing the output data, a subsequent call to getResponseCode or getInputStream will resend the POST request headers initiating a new connection to the server. This is clearly not correct as no request body can be sent with the POST through the getResponseCode/getInputStream API.
        The following bug seems to be related to this one.
        Attaching a test case, a web serivce calls itself via its own proxy recursively.
        - HttpURLConnection sends a request and waits for ever in getResponseCode(). But the request doesn't reach GFv2UR2(same goes with tomcat)
        - The test case works well when keep-alive is disabled

        Running the test case:
        - Make sure that GF uses 8080 port(which is its default)
        - increase http request threads to 25 in $GF/domains/domain1/config/domain.xml
        <request-processing header-buffer-length-in-bytes="8192" initial-thread-count="2" request-timeout-in-seconds="30" thread-count="25" thread-increment="1"/>
        - cp BreakMeAgain.jar $GF/domains/domain1/autodeploy/
        - $GF/bin/asadmin start-domain
        - Use browser to start the test: http://localhost:8080/BreakmeService/BreakMeService?tester
          use 10 as input. GF server.log only prints 10,9 and see that a thread is hanging in HttpURLConnection.getResponseCode(). If the keep-alive is disabled, it prints 10,9,8,7, ...

        Jean Francois, can you provide more details of the analysis.

              Assignee:
              Chris Hegarty
              Reporter:
              Chris Hegarty
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: