You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Seumas Soltysik (JIRA)" <ji...@apache.org> on 2009/03/31 20:04:50 UTC

[jira] Created: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Proxy in JCA connector throws exception due to concurrency issues
-----------------------------------------------------------------

                 Key: CXF-2145
                 URL: https://issues.apache.org/jira/browse/CXF-2145
             Project: CXF
          Issue Type: Bug
          Components: Integration
    Affects Versions: 2.2, 2.0.6, 2.1
            Reporter: Seumas Soltysik


A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .

The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.

[3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
                                 java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
            at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
            at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
            at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
            at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
            at $Proxy50.lookupTargetObject(Unknown Source) 
            at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
            at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
            at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
            at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
            at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
            at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
            at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
            at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
            at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
            at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
            at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
            at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
            at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
            at org.mortbay.jetty.Server.handle(Server.java:324) 
            at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
            at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
            at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
            at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
            at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
            at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
            at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-2145:
--------------------------------

    Assignee: Daniel Kulp

> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>
>                 Key: CXF-2145
>                 URL: https://issues.apache.org/jira/browse/CXF-2145
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>            Assignee: Daniel Kulp
>         Attachments: patch.txt, patch2.txt, patch3.txt
>
>
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
>                                  java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
>             at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
>             at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
>             at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
>             at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
>             at org.mortbay.jetty.Server.handle(Server.java:324) 
>             at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
>             at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
>             at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
>             at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
>             at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
>             at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Posted by "William Tam (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12695402#action_12695402 ] 

William Tam commented on CXF-2145:
----------------------------------

Looks good.  Just a quick/minor comment in restoring the saved classloader (in MDBActivationWork.run() method).

         try {
+            savedClassLoader = Thread.currentThread().getContextClassLoader();
+            ClassLoader classLoader = mep.getClass().getClassLoader();
             Thread.currentThread().setContextClassLoader(classLoader);
-            activate(endpoint, classLoader);
+            activate(invoker, classLoader);
         } finally {
+            invoker.releaseEndpoint(mep);
             Thread.currentThread().setContextClassLoader(savedClassLoader);
         }

You may want to check for null savedClassLoader before restoring to be safe.

> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>
>                 Key: CXF-2145
>                 URL: https://issues.apache.org/jira/browse/CXF-2145
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>         Attachments: patch.txt, patch2.txt
>
>
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
>                                  java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
>             at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
>             at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
>             at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
>             at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
>             at org.mortbay.jetty.Server.handle(Server.java:324) 
>             at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
>             at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
>             at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
>             at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
>             at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
>             at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Posted by "William Tam (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694336#action_12694336 ] 

William Tam edited comment on CXF-2145 at 3/31/09 6:01 PM:
-----------------------------------------------------------

I was wondering whether recycling MessageEndpoint instance is a good idea or not. I went back to the JCA spec. Then, I came to the conclusion that it is NOT a good thing. 

First, Chapter 12.5 Message Delivery in the JCA spec confirms the root problem. "The same endpoint instance may be used again to deliver subsequent messages serially, but it must not use the
same endpoint instance concurrently."

However, it is unnecessary for the resource adapter to pool endpoint instances. It says in the same chapter, "The resource adapter may call the release method on the proxy endpoint instance to indicate that it no longer needs the proxy instance. This hint may be used by the application server for proxy endpoint pooling decisions. This method call frees the state of the proxy instance. The released proxy instance may be reused for further proxy endpoint requests from the same resource adapter." That means, the application server may already maintain a pool of endpoint instances per resource adapter. We should just call the release() method on the endpoint instance and call createEndpoint() when it is needed again. I guess the biggest issue of our pooling is XA transaction support (in the future). Each endpoint could be attached to a different XAResource at creation time.

I think a fix would be to have the MDBInvoker() holding on to a MessageEndpointFactory instead of a MessageEndpoint instance. In the getServiceObject(), it calls createEndpoint() and release() when it is done.

(BTW, it looks like a bug in the patch that the MDBInvoker.getServiceObject() is not recycling endpoint instance.) 

      was (Author: wtam):
    I was wondering whether recycling MessageEndpoint instance is a good idea or not. I went back to the JCA spec. Then, I came to the conclusion that it is NOT a good thing. 

First, Chapter 1.5 Message Delivery in the JCA spec confirms the root problem. "The same endpoint instance may be used again to deliver subsequent messages serially, but it must not use the
same endpoint instance concurrently."

However, it is unnecessary for the resource adapter to pool endpoint instances. It says in the same chapter, "The resource adapter may call the release method on the proxy endpoint instance to indicate that it no longer needs the proxy instance. This hint may be used by the application server for proxy endpoint pooling decisions. This method call frees the state of the proxy instance. The released proxy instance may be reused for further proxy endpoint requests from the same resource adapter." That means, the application server may already maintain a pool of endpoint instances per resource adapter. We should just call the release() method on the endpoint instance and call createEndpoint() when it is needed again. I guess the biggest issue of our pooling is XA transaction support (in the future). Each endpoint could be attached to a different XAResource at creation time.

I think a fix would be to have the MDBInvoker() holding on to a MessageEndpointFactory instead of a MessageEndpoint instance. In the getServiceObject(), it calls createEndpoint() and release() when it is done.

(BTW, it looks like a bug in the patch that the MDBInvoker.getServiceObject() is not recycling endpoint instance.) 
  
> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>
>                 Key: CXF-2145
>                 URL: https://issues.apache.org/jira/browse/CXF-2145
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>         Attachments: patch.txt
>
>
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
>                                  java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
>             at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
>             at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
>             at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
>             at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
>             at org.mortbay.jetty.Server.handle(Server.java:324) 
>             at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
>             at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
>             at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
>             at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
>             at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
>             at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-2145.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.1
                   2.1.5
                   2.0.11

> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>
>                 Key: CXF-2145
>                 URL: https://issues.apache.org/jira/browse/CXF-2145
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>            Assignee: Daniel Kulp
>             Fix For: 2.0.11, 2.1.5, 2.2.1
>
>         Attachments: patch.txt, patch2.txt, patch3.txt
>
>
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
>                                  java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
>             at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
>             at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
>             at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
>             at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
>             at org.mortbay.jetty.Server.handle(Server.java:324) 
>             at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
>             at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
>             at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
>             at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
>             at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
>             at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Posted by "Seumas Soltysik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seumas Soltysik updated CXF-2145:
---------------------------------

    Attachment: patch2.txt

This second patch simplifies the process of retreiving a new endpoint for each invocation. Instead of maintaining a pool of endpoint, the patch relies on the pooling of endpoint by the app server according to spec. After each invocation the endpoint is released and recycled by the application server.

> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>
>                 Key: CXF-2145
>                 URL: https://issues.apache.org/jira/browse/CXF-2145
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>         Attachments: patch.txt, patch2.txt
>
>
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
>                                  java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
>             at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
>             at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
>             at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
>             at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
>             at org.mortbay.jetty.Server.handle(Server.java:324) 
>             at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
>             at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
>             at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
>             at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
>             at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
>             at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Posted by "Seumas Soltysik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seumas Soltysik updated CXF-2145:
---------------------------------

    Attachment: patch.txt

This is patch for 2.0.x but undoubted needs to also be applied to 2.1.x and trunk. The patch adds  a pool for EJB/MDB proxies to avoid thread concurrency issues.

> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>
>                 Key: CXF-2145
>                 URL: https://issues.apache.org/jira/browse/CXF-2145
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>         Attachments: patch.txt
>
>
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
>                                  java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
>             at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
>             at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
>             at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
>             at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
>             at org.mortbay.jetty.Server.handle(Server.java:324) 
>             at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
>             at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
>             at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
>             at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
>             at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
>             at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Posted by "William Tam (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694336#action_12694336 ] 

William Tam edited comment on CXF-2145 at 3/31/09 7:41 PM:
-----------------------------------------------------------

I was wondering whether recycling MessageEndpoint instance is a good idea or not. I went back to the JCA spec. Then, I came to the conclusion that it is NOT a good thing. 

First, Chapter 12.5 Message Delivery in the JCA spec confirms the root problem. "The same endpoint instance may be used again to deliver subsequent messages serially, but it must not use the
same endpoint instance concurrently."

However, it is unnecessary for the resource adapter to pool endpoint instances. It says in the same chapter, "The resource adapter may call the release method on the proxy endpoint instance to indicate that it no longer needs the proxy instance. This hint may be used by the application server for proxy endpoint pooling decisions. This method call frees the state of the proxy instance. The released proxy instance may be reused for further proxy endpoint requests from the same resource adapter." That means, the application server may already maintain a pool of endpoint instances per resource adapter. We should just call the release() method on the endpoint instance and call createEndpoint() when it is needed again. I guess the biggest issue of our pooling is XA transaction support (in the future). Each endpoint could be attached to a different XAResource at creation time.

I think a fix would be to have the MDBInvoker() holding on to a MessageEndpointFactory instead of a MessageEndpoint instance. In the getServiceObject(), it calls createEndpoint() and release() when it is done.

(BTW, it looks like a bug in the patch that the DispatchMDBInvoker.releaseServiceObject() method should've been overridden to do nothing.) 

      was (Author: wtam):
    I was wondering whether recycling MessageEndpoint instance is a good idea or not. I went back to the JCA spec. Then, I came to the conclusion that it is NOT a good thing. 

First, Chapter 12.5 Message Delivery in the JCA spec confirms the root problem. "The same endpoint instance may be used again to deliver subsequent messages serially, but it must not use the
same endpoint instance concurrently."

However, it is unnecessary for the resource adapter to pool endpoint instances. It says in the same chapter, "The resource adapter may call the release method on the proxy endpoint instance to indicate that it no longer needs the proxy instance. This hint may be used by the application server for proxy endpoint pooling decisions. This method call frees the state of the proxy instance. The released proxy instance may be reused for further proxy endpoint requests from the same resource adapter." That means, the application server may already maintain a pool of endpoint instances per resource adapter. We should just call the release() method on the endpoint instance and call createEndpoint() when it is needed again. I guess the biggest issue of our pooling is XA transaction support (in the future). Each endpoint could be attached to a different XAResource at creation time.

I think a fix would be to have the MDBInvoker() holding on to a MessageEndpointFactory instead of a MessageEndpoint instance. In the getServiceObject(), it calls createEndpoint() and release() when it is done.

  
> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>
>                 Key: CXF-2145
>                 URL: https://issues.apache.org/jira/browse/CXF-2145
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>         Attachments: patch.txt
>
>
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
>                                  java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
>             at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
>             at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
>             at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
>             at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
>             at org.mortbay.jetty.Server.handle(Server.java:324) 
>             at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
>             at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
>             at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
>             at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
>             at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
>             at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Posted by "Seumas Soltysik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seumas Soltysik updated CXF-2145:
---------------------------------

    Attachment: patch3.txt

One more time.

> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>
>                 Key: CXF-2145
>                 URL: https://issues.apache.org/jira/browse/CXF-2145
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>         Attachments: patch.txt, patch2.txt, patch3.txt
>
>
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
>                                  java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
>             at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
>             at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
>             at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
>             at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
>             at org.mortbay.jetty.Server.handle(Server.java:324) 
>             at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
>             at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
>             at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
>             at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
>             at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
>             at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Posted by "William Tam (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694336#action_12694336 ] 

William Tam commented on CXF-2145:
----------------------------------

I was wondering whether recycling MessageEndpoint instance is a good idea or not. I went back to the JCA spec. Then, I came to the conclusion that it is NOT a good thing. 

First, Chapter 1.5 Message Delivery in the JCA spec confirms the root problem. "The same endpoint instance may be used again to deliver subsequent messages serially, but it must not use the
same endpoint instance concurrently."

However, it is unnecessary for the resource adapter to pool endpoint instances. It says in the same chapter, "The resource adapter may call the release method on the proxy endpoint instance to indicate that it no longer needs the proxy instance. This hint may be used by the application server for proxy endpoint pooling decisions. This method call frees the state of the proxy instance. The released proxy instance may be reused for further proxy endpoint requests from the same resource adapter." That means, the application server may already maintain a pool of endpoint instances per resource adapter. We should just call the release() method on the endpoint instance and call createEndpoint() when it is needed again. I guess the biggest issue of our pooling is XA transaction support (in the future). Each endpoint could be attached to a different XAResource at creation time.

I think a fix would be to have the MDBInvoker() holding on to a MessageEndpointFactory instead of a MessageEndpoint instance. In the getServiceObject(), it calls createEndpoint() and release() when it is done.

(BTW, it looks like a bug in the patch that the MDBInvoker.getServiceObject() is not recycling endpoint instance.) 

> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>
>                 Key: CXF-2145
>                 URL: https://issues.apache.org/jira/browse/CXF-2145
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>         Attachments: patch.txt
>
>
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
>                                  java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
>             at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
>             at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
>             at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
>             at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
>             at org.mortbay.jetty.Server.handle(Server.java:324) 
>             at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
>             at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
>             at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
>             at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
>             at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
>             at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues

Posted by "William Tam (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694336#action_12694336 ] 

William Tam edited comment on CXF-2145 at 3/31/09 7:37 PM:
-----------------------------------------------------------

I was wondering whether recycling MessageEndpoint instance is a good idea or not. I went back to the JCA spec. Then, I came to the conclusion that it is NOT a good thing. 

First, Chapter 12.5 Message Delivery in the JCA spec confirms the root problem. "The same endpoint instance may be used again to deliver subsequent messages serially, but it must not use the
same endpoint instance concurrently."

However, it is unnecessary for the resource adapter to pool endpoint instances. It says in the same chapter, "The resource adapter may call the release method on the proxy endpoint instance to indicate that it no longer needs the proxy instance. This hint may be used by the application server for proxy endpoint pooling decisions. This method call frees the state of the proxy instance. The released proxy instance may be reused for further proxy endpoint requests from the same resource adapter." That means, the application server may already maintain a pool of endpoint instances per resource adapter. We should just call the release() method on the endpoint instance and call createEndpoint() when it is needed again. I guess the biggest issue of our pooling is XA transaction support (in the future). Each endpoint could be attached to a different XAResource at creation time.

I think a fix would be to have the MDBInvoker() holding on to a MessageEndpointFactory instead of a MessageEndpoint instance. In the getServiceObject(), it calls createEndpoint() and release() when it is done.


      was (Author: wtam):
    I was wondering whether recycling MessageEndpoint instance is a good idea or not. I went back to the JCA spec. Then, I came to the conclusion that it is NOT a good thing. 

First, Chapter 12.5 Message Delivery in the JCA spec confirms the root problem. "The same endpoint instance may be used again to deliver subsequent messages serially, but it must not use the
same endpoint instance concurrently."

However, it is unnecessary for the resource adapter to pool endpoint instances. It says in the same chapter, "The resource adapter may call the release method on the proxy endpoint instance to indicate that it no longer needs the proxy instance. This hint may be used by the application server for proxy endpoint pooling decisions. This method call frees the state of the proxy instance. The released proxy instance may be reused for further proxy endpoint requests from the same resource adapter." That means, the application server may already maintain a pool of endpoint instances per resource adapter. We should just call the release() method on the endpoint instance and call createEndpoint() when it is needed again. I guess the biggest issue of our pooling is XA transaction support (in the future). Each endpoint could be attached to a different XAResource at creation time.

I think a fix would be to have the MDBInvoker() holding on to a MessageEndpointFactory instead of a MessageEndpoint instance. In the getServiceObject(), it calls createEndpoint() and release() when it is done.

(BTW, it looks like a bug in the patch that the MDBInvoker.getServiceObject() is not recycling endpoint instance.) 
  
> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>
>                 Key: CXF-2145
>                 URL: https://issues.apache.org/jira/browse/CXF-2145
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>         Attachments: patch.txt
>
>
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere 6.1.0.19, HP/UX version B.11.23, Java 1.5.0.13 .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which is causing the exception to be thrown. The solution is to create a pool of proxies which can be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome 
>                                  java.lang.IllegalStateException: Multiple threads can not use same MessageEndpoint proxy instance concurrently 
>             at com.ibm.ejs.container.MessageEndpointHandler.throwIllegalStateException(MessageEndpointHandler.java:599) 
>             at com.ibm.ejs.container.MessageEndpointHandler.checkState(MessageEndpointHandler.java:433) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:889) 
>             at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747) 
>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(DispatchMDBInvoker.java:57) 
>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) 
>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) 
>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) 
>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:280) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:254) 
>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) 
>             at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) 
>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) 
>             at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
>             at org.mortbay.jetty.Server.handle(Server.java:324) 
>             at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 
>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) 
>             at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) 
>             at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 
>             at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 
>             at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 
>             at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.