Uploaded image for project: 'ServiceMix Components'
  1. ServiceMix Components
  2. SM-1694 serviceassembly deployment is blocked/delayed by already loaded serviceassemblies
  3. SMXCOMP-344

BeanEndpoint can receive messages before it has fully started, causing exceptions

Attach filesAttach ScreenshotVotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      I have a Sender endpoint and a Receiver endpoint, both BeanEndpoint objects. The Sender endpoint immediately starts sending messages. Every so often, the receiver endpoint accepts tries to process a message the start() method has completed, causing the following exception:

      java.lang.NullPointerException
      at org.apache.servicemix.bean.BeanEndpoint.getCorrelationExpression(BeanEndpoint.java:421)
      at org.apache.servicemix.bean.BeanEndpoint.getCorrelation(BeanEndpoint.java:298)
      at org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:218)
      at org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
      at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
      at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
      at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
      at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
      at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
      at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
      at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:613)

      For now, I've put a sleep in the sender endpoint, which fixes the problem. Obviously, this a hack.

      I originally thought that the original solution would be to move the super.start() call to the end of the start() method. However, this turned out to cause problems for the sender endpoint.

      I have two options to propose:

      • use synchronization to ensure the bean has started, so that the process() method blocks until the start() method has finished. This has the disadvantage of incurring a synchronization hit on each message exchange.
      • separate the activation of an endpoint from the registration. This way an endpoint would be ready to go by being activated, but wouldn't be visible to other endpoints until the start() method has finished. I'm not sure what code changes would need be necessary to make this happen.

      Attachments

        Activity

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

          People

            ccustine Chris Custine
            rbohn Ryan Bohn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment