hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HTTPCLIENT-1314) Deadlock in http.client.fluent.Async.ExecRunnable.run() if there is an exception in FutureCallback
Date Fri, 01 Feb 2013 13:06:12 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oleg Kalnichevski resolved HTTPCLIENT-1314.
-------------------------------------------

    Resolution: Duplicate
    
> Deadlock in http.client.fluent.Async.ExecRunnable.run() if there is an exception in FutureCallback
> --------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1314
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1314
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.2.3, 4.3 Alpha1
>         Environment: Windows 7 64bits
>            Reporter: Andrey P
>              Labels: fluent, httpclient
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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;
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message