Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8626

async http client may handle response by multiple threads on work queue

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.5.0, 3.3.13, 3.4.6
    • None
    • None
    • Unknown

    Description

      In the AsyncHttpConduit, we have code like

      protected synchronized void setHttpResponse(HttpResponse r) {
                  httpResponse = r;
                  if (isAsync) {
                      //got a response, need to start the response processing now
                      try {
                          handleResponseOnWorkqueue(false, true);
                          isAsync = false; // don't trigger another start on next block. :-)
                      } catch (Exception ex) {
                          //ignore, we'll try again on the next consume;
                      }
                  }
                  notifyAll();
              }
      

      which intends to spin only one threads to handle response, not matter how many blocks the response contains. However, in some cases, the isAsync field can be reset true by handleResponseAsync method, hence the second thread can be launched to handle the same response stream, so can mess up the response stream. Actually isAsync has already been initialized correctly when the first time to create AsyncWrappedOutputStream, so method handleResponseAsync shouldn't reset it.

      We can see this problem when enabling retransmit && chunklength<payload

      Attachments

        Issue Links

          Activity

            People

              ffang Freeman Yue Fang
              ffang Freeman Yue Fang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: