Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1314

Deadlock in http.client.fluent.Async.ExecRunnable.run() if there is an exception in FutureCallback

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 4.2.3, 4.3 Alpha1
    • None
    • HttpClient (classic)
    • Windows 7 64bits

    Description

      Deadlock in http.client.fluent.Async.ExecRunnable.run() if an exception is thrown in FutureCallback.completed()
      Look at the <<<http.client.fluent.Async.ExecRunnable.run()>>> method:
      public void run() {
      try

      { Response response = this.executor.execute(this.request); T result = response.handleResponse(this.handler); this.future.completed(result); }

      catch (Exception ex)

      { **** this is never called because the BasicFuture.completed flag is set to true BEFORE the callback invocation **** (see below) this.future.failed(ex); }

      }

      <<<http.concurrent.BasicFuture>>>
      public synchronized boolean completed(final T result) {
      if (this.completed)

      { return false; }
      this.completed = true;
      this.result = result;
      if (this.callback != null) { this.callback.completed(result); }
      *** not executed if an exception in the callback.completed()
      notifyAll();
      return true;
      }
      public synchronized boolean failed(final Exception exception) {
      if (this.completed) { return false; }
          • the following can't be reached if there is an exception in this.callback.completed() so that
          • BasicFuture.get() waits forever

      this.completed = true;
      this.ex = exception;
      if (this.callback != null)

      { this.callback.failed(exception); }

      notifyAll();
      return true;
      }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              apolishko Andrey P
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 2h
                  2h
                  Remaining:
                  Remaining Estimate - 2h
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified