Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-1878

ConcurrentModificationException in initHandlerChain()

    XMLWordPrintable

Details

    • Medium

    Description

      When SOAP requests hit JBoss during application deployment they are somewhat queued and get processed just after the application starts. Everything works fine if the are only several requests. If there are more (like 30 or above) before the application starts, HandlerResolverImpl causes ConcurrentModificationException at line 22 (getHandlerChain()).
      This exception does not cause the application to stop working, but results in a very strange behaviour, namely: every request goes only through JAXWS Handler twice (on inbound and outbound traffic) but does not hit service implementation (in my case - EJB3 SLSB).
      The only clue for me to resolve this problem was to stick to the ConcurrentModificationException and its stacktrace. Going down this path I decided to modify some code in class org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS. I synchronized a block of code responsible for initiating handler chains, so the modified method looks like this:

      public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
      {
      log.debug("callRequestHandlerChain: " + type);

      // Initialize the handler chain
      if (isInitialized() == false)
      {
      synchronized(resolver)

      { resolver.initHandlerChain(sepMetaData, HandlerType.PRE, true); resolver.initHandlerChain(sepMetaData, HandlerType.ENDPOINT, true); resolver.initHandlerChain(sepMetaData, HandlerType.POST, true); setInitialized(true); }

      }

      HandlerChainExecutor executor = createExecutor(sepMetaData, type);
      MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
      return executor.handleMessage(msgContext);
      }

      I tried to do synchronized(this) at the beginning but it very quickly resulted in unstable AS behaviour and stopping JVM with a core dump in the end (SIC!).

      Since we are talking about serious production deployment in 5 days (servicing ca. 5000 SOAP requests per hour) , I decided to incorporate my fix into the environment, but I am not completely sure wheter my fix imposes any performance pitfalls.
      If you find a better idea to solve this problem, please be quick to publish a solution

      Attachments

        Issue Links

          Activity

            People

              tdiesler@redhat.com Thomas Diesler
              wkudla Wojciech Kudla (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: