0 Replies Latest reply on Sep 10, 2009 7:03 AM by James Baxter

    Threading issues with WrapperDataSourceService in 4.0.5GA?

    James Baxter Newbie

      Hi there,

      I have exposed my DataSource over JNDI (to an external JVM) from JBoss by setting use-java-context to false. The external process is multi-threaded and doing a lot of database queries. I am getting the following exception periodically...

      2009-09-10 11:12:40 ERROR PDMThread_3 [com.aps_uk.pdm.agent.PDMThread] Unknown error halting execution
      java.lang.reflect.UndeclaredThrowableException
       at $Proxy8.close(Unknown Source)
       at com.aps_uk.pdm.common.util.DatabaseUtils.closeSilently(DatabaseUtils.java:28)
       at com.aps_uk.pdm.agent.v4.V4Document.doProcessRecord(V4Document.java:110)
       at com.aps_uk.pdm.agent.v4.BaseConverter.processRecord(BaseConverter.java:50)
       at com.aps_uk.pdm.agent.PDMThread.run(PDMThread.java:128)
      Caused by: java.lang.IllegalAccessException: Failed to find ResultSet: 17347336
       at org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService.invoke(WrapperDataSourceService.java:231)
       at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
       at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
       at sun.reflect.GeneratedMethodAccessor262.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
       at sun.rmi.transport.Transport$1.run(Transport.java:153)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
       at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
       at java.lang.Thread.run(Thread.java:595)
       at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
       at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
       at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
       at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
       at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:119)
       at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
       at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167)
       at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:59)
       at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
       ... 5 more
      


      As you can see if appears ResultSet '17347336' has disappeared midprocess.

      Looking the JBoss server logs I can see...

      2009-09-10 11:12:40 DEBUG [org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Created ResultSet proxy for invoker=jboss:service=invoker,type=jrmp, targetName=jboss.jca:service=DataSourceBinding,name=V4DATASOURCE, cacheID=17347336
      
      2009-09-10 11:12:40 DEBUG [org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Created ResultSet proxy for invoker=jboss:service=invoker,type=jrmp, targetName=jboss.jca:service=DataSourceBinding,name=V4DATASOURCE, cacheID=17347336
      
      2009-09-10 11:12:40 DEBUG [org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Closed ResultSet=17347336
      


      It seems the WrapperDataSourceService is giving the same cacheID to two ResultSets, and when one of my threads closes the ResultSet, the other throws an exception when it attempts to use it...

      I have just spotted the following post from Weston Price which points out remote usage is experimental... http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3982218

      Unfortunatly upgrading JBoss is not possible, does anyone know if it is possible to recompile JBoss with an updated (fixed) WrapperDataSourceService? Does it still exist even...