[
https://jira.jboss.org/browse/JBAS-7666?page=com.atlassian.jira.plugin.sy...
]
Jiri Pechanec updated JBAS-7666:
--------------------------------
Attachment: testconn.zip
Datasource is configured by file resources/test-ds.xml
Test execution
[jpechane@dhcp-0-121 testconn]$ ant -Dtest.threadcount=1
Buildfile: build.xml
compile:
run:
[java] Running with 1 thread(s)
[java] log4j:WARN No appenders could be found for logger
(org.jnp.interfaces.TimedSocketFactory).
[java] log4j:WARN Please initialize the log4j system properly.
^C[jpechane@dhcp-0-121 testconn]$ ant -Dtest.threadcount=2
Buildfile: build.xml
compile:
run:
[java] Running with 2 thread(s)
[java] log4j:WARN No appenders could be found for logger
(org.jnp.interfaces.TimedSocketFactory).
[java] log4j:WARN Please initialize the log4j system properly.
[java] log4j:WARN No appenders could be found for logger
(org.jnp.interfaces.TimedSocketFactory).
[java] log4j:WARN Please initialize the log4j system properly.
[java] java.lang.reflect.UndeclaredThrowableException
[java] at $Proxy1.close(Unknown Source)
[java] at TestConnections$1.run(Unknown Source)
[java] at java.lang.Thread.run(Thread.java:619)
[java] Caused by: java.lang.IllegalAccessException: Failed to find connection:
24219945
[java] at
org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService.invoke(WrapperDataSourceService.java:212)
[java] at sun.reflect.GeneratedMethodAccessor308.invoke(Unknown Source)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
[java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
[java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
[java] at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
[java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
[java] at
org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:855)
[java] at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:422)
[java] at sun.reflect.GeneratedMethodAccessor307.invoke(Unknown Source)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
[java] at sun.rmi.transport.Transport$1.run(Transport.java:159)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
[java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
[java] at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
[java] at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
[java] at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[java] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[java] at java.lang.Thread.run(Thread.java:619)
[java] at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
[java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
[java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
[java] at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
[java] at
org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:133)
[java] at
org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
[java] at
org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
[java] at
org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
[java] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
[java] ... 3 more
Datasource wrapper returns same java.sql.Connection object to
multiple threads in multithreaded environment
------------------------------------------------------------------------------------------------------------
Key: JBAS-7666
URL:
https://jira.jboss.org/browse/JBAS-7666
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: JCA service
Affects Versions: JBossAS-5.1.0.GA
Environment: JBoss Version: jboss-5.1.0.GA, OS: Linux (2.6.18-164.el5),
Architecture: amd64 64bit, JVM: Java HotSpot(TM) 64-Bit Server VM (14.0-b16, mixed mode)
Reporter: Smita Nimbalkar
Attachments: testconn.zip
Sometimes this happens that in multithreaded environment Datasource wrapper returns same
java.sql.Connection object from connection pool to different threads.
Test case scenario:
There are multiple threads which needs java.sql.Connection object. If one thread has
reference to java.sql.Connection then when other thread requests connection then it gets
reference to same java.sql.Connection object that means two threads has reference to same
connection object from the pool.
If one thread closes this connection first and then other thread tries to do any
operation on connection object then we get following exception:
Caused by: java.lang.IllegalAccessException: Failed to find connection: 14271357
at
org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService.invoke(WrapperDataSourceService.java:212)
at sun.reflect.GeneratedMethodAccessor281.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at
org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:855)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:422)
at sun.reflect.GeneratedMethodAccessor283.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
at
org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:133)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
... 17 more
I am using MySQL Connector/J 5.1.10 JDBC driver.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira