jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stanislav Dvorscak (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (JCR-3379) XA concurrent transactions - NullPointerException
Date Mon, 09 Jul 2012 10:04:35 GMT

     [ https://issues.apache.org/jira/browse/JCR-3379?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Stanislav Dvorscak updated JCR-3379:
------------------------------------

    Description: 
If several threads are working with XA transactions, the NullPointerException is randomly
happened. After that each other transaction will deadlock on the Jackrabbit side, and the
restart of the server is necessary.

The exception is:
Exception in thread "executor-13" java.lang.NullPointerException
	at org.apache.jackrabbit.core.version.VersioningLock$XidRWLock.isSameGlobalTx(VersioningLock.java:116)
	at org.apache.jackrabbit.core.version.VersioningLock$XidRWLock.allowReader(VersioningLock.java:126)
	at org.apache.jackrabbit.core.version.VersioningLock$XidRWLock.endWrite(VersioningLock.java:161)
	at EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock$WriterLock.release(Unknown
Source)
	at org.apache.jackrabbit.core.version.VersioningLock$WriteLock.release(VersioningLock.java:76)
	at org.apache.jackrabbit.core.version.InternalXAVersionManager$2.internalReleaseWriteLock(InternalXAVersionManager.java:703)
	at org.apache.jackrabbit.core.version.InternalXAVersionManager$2.commit(InternalXAVersionManager.java:691)
	at org.apache.jackrabbit.core.TransactionContext.commit(TransactionContext.java:195)
	at org.apache.jackrabbit.core.XASessionImpl.commit(XASessionImpl.java:326)
	at org.apache.jackrabbit.rmi.server.ServerXASession.commit(ServerXASession.java:58)
	at sun.reflect.GeneratedMethodAccessor17.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:662)
	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
	at org.apache.jackrabbit.rmi.server.ServerXASession_Stub.commit(Unknown Source)
	at org.apache.jackrabbit.rmi.client.ClientXASession.commit(ClientXASession.java:74)
	at org.objectweb.jotm.SubCoordinator.doCommit(SubCoordinator.java:1123)
	at org.objectweb.jotm.SubCoordinator.commit_one_phase(SubCoordinator.java:483)
	at org.objectweb.jotm.TransactionImpl.commit(TransactionImpl.java:318)
	at org.objectweb.jotm.Current.commit(Current.java:452)
	at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1010)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

And the point of the other deadlocks is:

Thread [executor-13] (Suspended)	
	SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available
[native method]	
	SocketInputStream.read(byte[], int, int) line: 129	
	BufferedInputStream.fill() line: 218	
	BufferedInputStream.read() line: 237	
	DataInputStream.readByte() line: 248	
	StreamRemoteCall.executeCall() line: 195	
	UnicastRef.invoke(Remote, Method, Object[], long) line: 142	
	ServerXASession_Stub.prepare(Xid) line: not available	
	ClientXASession.prepare(Xid) line: 106	
	SubCoordinator.doPrepare() line: 829	
	SubCoordinator.commit_one_phase() line: 480	
	TransactionImpl.commit() line: 318	
	Current.commit() line: 452	
	JtaTransactionManager.doCommit(DefaultTransactionStatus) line: 1010	
	JtaTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus)
line: 754	
	JtaTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus) line:
723	
	TransactionInterceptor(TransactionAspectSupport).commitTransactionAfterReturning(TransactionAspectSupport$TransactionInfo)
line: 393	
	TransactionInterceptor.invoke(MethodInvocation) line: 120	
	ReflectiveMethodInvocation.proceed() line: 172	
	JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 202	
	$Proxy94.processProductDetail(String) line: not available	
	ProcessProductDetailConsumer$1.run() line: 79	
	ThreadPoolExecutor$Worker.runTask(Runnable) line: 886	
	ThreadPoolExecutor$Worker.run() line: 908	
	Thread.run() line: 680	


  was:
If several threads are working with XA transactions, the NullPointerException is randomly
happened. After that each other transaction will deadlock on the Jackrabbit side, and the
restart of the server is necessary.

The exception is:
Exception in thread "executor-13" java.lang.NullPointerException
	at org.apache.jackrabbit.core.version.VersioningLock$XidRWLock.isSameGlobalTx(VersioningLock.java:116)
	at org.apache.jackrabbit.core.version.VersioningLock$XidRWLock.allowReader(VersioningLock.java:126)
	at org.apache.jackrabbit.core.version.VersioningLock$XidRWLock.endWrite(VersioningLock.java:161)
	at EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock$WriterLock.release(Unknown
Source)
	at org.apache.jackrabbit.core.version.VersioningLock$WriteLock.release(VersioningLock.java:76)
	at org.apache.jackrabbit.core.version.InternalXAVersionManager$2.internalReleaseWriteLock(InternalXAVersionManager.java:703)
	at org.apache.jackrabbit.core.version.InternalXAVersionManager$2.commit(InternalXAVersionManager.java:691)
	at org.apache.jackrabbit.core.TransactionContext.commit(TransactionContext.java:195)
	at org.apache.jackrabbit.core.XASessionImpl.commit(XASessionImpl.java:326)
	at org.apache.jackrabbit.rmi.server.ServerXASession.commit(ServerXASession.java:58)
	at sun.reflect.GeneratedMethodAccessor17.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:662)
	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
	at org.apache.jackrabbit.rmi.server.ServerXASession_Stub.commit(Unknown Source)
	at org.apache.jackrabbit.rmi.client.ClientXASession.commit(ClientXASession.java:74)
	at org.objectweb.jotm.SubCoordinator.doCommit(SubCoordinator.java:1123)
	at org.objectweb.jotm.SubCoordinator.commit_one_phase(SubCoordinator.java:483)
	at org.objectweb.jotm.TransactionImpl.commit(TransactionImpl.java:318)
	at org.objectweb.jotm.Current.commit(Current.java:452)
	at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1010)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

And the point of the other deadlocks is:

Thread [executor-13] (Suspended)	
	SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available
[native method]	
	SocketInputStream.read(byte[], int, int) line: 129	
	BufferedInputStream.fill() line: 218	
	BufferedInputStream.read() line: 237	
	DataInputStream.readByte() line: 248	
	StreamRemoteCall.executeCall() line: 195	
	UnicastRef.invoke(Remote, Method, Object[], long) line: 142	
	ServerXASession_Stub.prepare(Xid) line: not available	
	ClientXASession.prepare(Xid) line: 106	
	SubCoordinator.doPrepare() line: 829	
	SubCoordinator.commit_one_phase() line: 480	
	TransactionImpl.commit() line: 318	
	Current.commit() line: 452	
	JtaTransactionManager.doCommit(DefaultTransactionStatus) line: 1010	
	JtaTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus)
line: 754	
	JtaTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus) line:
723	
	TransactionInterceptor(TransactionAspectSupport).commitTransactionAfterReturning(TransactionAspectSupport$TransactionInfo)
line: 393	
	TransactionInterceptor.invoke(MethodInvocation) line: 120	
	ReflectiveMethodInvocation.proceed() line: 172	
	JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 202	
	$Proxy94.processProductDetail(String) line: not available	
	ProcessProductDetailConsumer$1.run() line: 79	
	ThreadPoolExecutor$Worker.runTask(Runnable) line: 886	
	ThreadPoolExecutor$Worker.run() line: 908	
	Thread.run() line: 680	

I fixed this bug as the:
diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersioningLock.java
b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersioningLock.java
index c9a9a77..9716b0a 100644
--- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersioningLock.java
+++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersioningLock.java
@@ -113,7 +113,7 @@ public class VersioningLock {
          * @return true if same globalTX otherwise false
          */
         boolean isSameGlobalTx(Xid otherXid) {
-            return (activeXid == otherXid) || Arrays.equals(activeXid.getGlobalTransactionId(),
otherXid.getGlobalTransactionId());
+            return activeXid != null && (activeXid == otherXid) || Arrays.equals(activeXid.getGlobalTransactionId(),
otherXid.getGlobalTransactionId());
         }
 
         /**

it seems that the activeXid is null. After this fix, I made the test of this one over 16 parallel
threads and 30 000 commits, it seems no problem was appeared again.

    
> XA concurrent transactions - NullPointerException
> -------------------------------------------------
>
>                 Key: JCR-3379
>                 URL: https://issues.apache.org/jira/browse/JCR-3379
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.4.2, 2.5
>         Environment: java version "1.6.0_26"
> Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
> Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
> Linux dev 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012 x86_64 GNU/Linux
>            Reporter: Stanislav Dvorscak
>
> If several threads are working with XA transactions, the NullPointerException is randomly
happened. After that each other transaction will deadlock on the Jackrabbit side, and the
restart of the server is necessary.
> The exception is:
> Exception in thread "executor-13" java.lang.NullPointerException
> 	at org.apache.jackrabbit.core.version.VersioningLock$XidRWLock.isSameGlobalTx(VersioningLock.java:116)
> 	at org.apache.jackrabbit.core.version.VersioningLock$XidRWLock.allowReader(VersioningLock.java:126)
> 	at org.apache.jackrabbit.core.version.VersioningLock$XidRWLock.endWrite(VersioningLock.java:161)
> 	at EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock$WriterLock.release(Unknown
Source)
> 	at org.apache.jackrabbit.core.version.VersioningLock$WriteLock.release(VersioningLock.java:76)
> 	at org.apache.jackrabbit.core.version.InternalXAVersionManager$2.internalReleaseWriteLock(InternalXAVersionManager.java:703)
> 	at org.apache.jackrabbit.core.version.InternalXAVersionManager$2.commit(InternalXAVersionManager.java:691)
> 	at org.apache.jackrabbit.core.TransactionContext.commit(TransactionContext.java:195)
> 	at org.apache.jackrabbit.core.XASessionImpl.commit(XASessionImpl.java:326)
> 	at org.apache.jackrabbit.rmi.server.ServerXASession.commit(ServerXASession.java:58)
> 	at sun.reflect.GeneratedMethodAccessor17.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:662)
> 	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
> 	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
> 	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
> 	at org.apache.jackrabbit.rmi.server.ServerXASession_Stub.commit(Unknown Source)
> 	at org.apache.jackrabbit.rmi.client.ClientXASession.commit(ClientXASession.java:74)
> 	at org.objectweb.jotm.SubCoordinator.doCommit(SubCoordinator.java:1123)
> 	at org.objectweb.jotm.SubCoordinator.commit_one_phase(SubCoordinator.java:483)
> 	at org.objectweb.jotm.TransactionImpl.commit(TransactionImpl.java:318)
> 	at org.objectweb.jotm.Current.commit(Current.java:452)
> 	at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1010)
> 	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
> 	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
> 	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
> 	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
> 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> 	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
> And the point of the other deadlocks is:
> Thread [executor-13] (Suspended)	
> 	SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available
[native method]	
> 	SocketInputStream.read(byte[], int, int) line: 129	
> 	BufferedInputStream.fill() line: 218	
> 	BufferedInputStream.read() line: 237	
> 	DataInputStream.readByte() line: 248	
> 	StreamRemoteCall.executeCall() line: 195	
> 	UnicastRef.invoke(Remote, Method, Object[], long) line: 142	
> 	ServerXASession_Stub.prepare(Xid) line: not available	
> 	ClientXASession.prepare(Xid) line: 106	
> 	SubCoordinator.doPrepare() line: 829	
> 	SubCoordinator.commit_one_phase() line: 480	
> 	TransactionImpl.commit() line: 318	
> 	Current.commit() line: 452	
> 	JtaTransactionManager.doCommit(DefaultTransactionStatus) line: 1010	
> 	JtaTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus)
line: 754	
> 	JtaTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus)
line: 723	
> 	TransactionInterceptor(TransactionAspectSupport).commitTransactionAfterReturning(TransactionAspectSupport$TransactionInfo)
line: 393	
> 	TransactionInterceptor.invoke(MethodInvocation) line: 120	
> 	ReflectiveMethodInvocation.proceed() line: 172	
> 	JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 202	
> 	$Proxy94.processProductDetail(String) line: not available	
> 	ProcessProductDetailConsumer$1.run() line: 79	
> 	ThreadPoolExecutor$Worker.runTask(Runnable) line: 886	
> 	ThreadPoolExecutor$Worker.run() line: 908	
> 	Thread.run() line: 680	

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message