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

CXF produces thread pinning when using virtual threads

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None
    • Unknown

    Description

      When using virtual threads, it's important to avoid the use of synchronized objects and methods because I/O operations executed in them will pin the virtual thread to its carrier thread, blocking the carrier thread instead of the virtual one.

      Executing some tests with a CXF client in a Tomcat server using virtual threads I see that, if I spawn a few tens of virtual threads I get a lot of thread pinning due to the code in 

       

      PhaseInterceptorChain

       

      In this class, there's a method that's invoked for all requests 

       

      public synchronized boolean doIntercept(Message message)

       

      This method pins the virtual thread to the carrier thread for all the duration of the request and response, which might be a lot of time and it hinders the multithreaded applications throughput. Just changing the use of synchronized keywords for ReentrantLocks will solve this issue.

       

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            getaceres Jose Antonio
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment