You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andy McCright (JIRA)" <ji...@apache.org> on 2018/10/22 21:56:00 UTC

[jira] [Assigned] (CXF-7881) HttpConduit.handleResponseOnWorkqueue will always handle response on current thread when allowCurrentThread is false and the work queue rejects the execution

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

Andy McCright reassigned CXF-7881:
----------------------------------

    Assignee: Andy McCright

> HttpConduit.handleResponseOnWorkqueue will always handle response on current thread when allowCurrentThread is false and the work queue rejects the execution
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-7881
>                 URL: https://issues.apache.org/jira/browse/CXF-7881
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 3.2.6
>            Reporter: Jan Hallonsten
>            Assignee: Andy McCright
>            Priority: Major
>
> Creating this Jira according to the discussion [here|http://cxf.547215.n5.nabble.com/Response-always-handled-on-current-thread-when-WorkQueue-rejects-execution-tt5793019.html]
> In the method 
> [org.apache.cxf.transport.http.HTTPConduit.handleResponseOnWorkqueue(boolean allowCurrentThread, boolean forceWQ)|https://github.com/apache/cxf/blob/540bb76f6f3d3d23944c566905f9f395c6f86b79/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java#L1190]
> If the work queue is full so that RejectedExecutionException is thrown and allowCurrentThread is false like when called from [AsyncHttpConduit|https://github.com/apache/cxf/blob/6db38f9984b9c0bf6309a3d7e26d5a9ab8055d1f/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java#L600] the expression in the if statement below will always return false and the response will be handled on the current thread via the call to handleResponseInternal. When used from AsyncHttpConduit this will be the IO core thread which is not a good idea.
> {code:java}
> } catch (RejectedExecutionException rex) {
>     if (allowCurrentThread
>         && policy != null
>         && policy.isSetAsyncExecuteTimeoutRejection()
>         && policy.isAsyncExecuteTimeoutRejection()) {
>         throw rex;
>     }
>     if (!hasLoggedAsyncWarning) {
>         LOG.warning("EXECUTOR_FULL_WARNING");
>         hasLoggedAsyncWarning = true;
>     }
>     LOG.fine("EXECUTOR_FULL");
>     handleResponseInternal();
> }
> {code}
> I think that the code above should be changed to
> {code:java}
> } catch (RejectedExecutionException rex) { 
>      if (!allowCurrentThread 
>          || (policy != null 
>          && policy.isSetAsyncExecuteTimeoutRejection() 
>          && policy.isAsyncExecuteTimeoutRejection())) { 
>          throw rex; 
>      } 
>      if (!hasLoggedAsyncWarning) { 
>          LOG.warning("EXECUTOR_FULL_WARNING"); 
>          hasLoggedAsyncWarning = true; 
>      } 
>      LOG.fine("EXECUTOR_FULL"); 
>      handleResponseInternal(); 
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)