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

HttpConduit.handleResponseOnWorkqueue will always handle response on current thread when allowCurrentThread is false and the work queue rejects the execution

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.6
    • 3.2.7, 3.3.0
    • Transports
    • None
    • Unknown

    Description

      Creating this Jira according to the discussion here

      In the method 

      org.apache.cxf.transport.http.HTTPConduit.handleResponseOnWorkqueue(boolean allowCurrentThread, boolean forceWQ)

      If the work queue is full so that RejectedExecutionException is thrown and allowCurrentThread is false like when called from AsyncHttpConduit 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.

      } 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();
      }
      

      I think that the code above should be changed to

      } 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(); 
      }
      

      Attachments

        Issue Links

          Activity

            People

              andymc Andrew J McMurry
              hallonbat Jan Hallonsten
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: