You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/10/22 22:09:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16659754#comment-16659754 ]
ASF GitHub Bot commented on CXF-7881:
-------------------------------------
andymc12 opened a new pull request #463: CXF-7881: Ensure proper allowCurrentThread behavior
URL: https://github.com/apache/cxf/pull/463
In the case where the current Executor throws a RejectedExecutionException:
This should ensure that if allowCurrentThread is false OR the client policy has setAsyncExecuteTimeoutRejection, then the the caller should receive a RejectedExecutionException.
If allowCurrentThread is true, then current thread will handle the async response.
This should resolve JIRA [CXF-7881](
https://issues.apache.org/jira/browse/CXF-7881)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
> 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)