hazelcast群集env上的缓存锁定问题当前线程不是锁的所有者! - &GT; <不锁定>

时间:2017-05-18 01:57:08

标签: spring multithreading hibernate jpa hazelcast

你好我在prod env中遇到了一个haelcast lock问题,我使用spring + hibernate + hazelcast这是一个集群机智2节点。当前的hazelcast版本是3.1.3

但我无法在我的本地环境中重现。我已经分析了它在JPA事务完成后尝试释放锁定所看到的日志。

以下是日志:

org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction
    at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:522)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:755)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:270)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)

at sun.reflect.GeneratedMethodAccessor525.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at com.csam.wsc.security.message.replay.filter.MessageReplayDetectionFilter.doFilter(MessageReplayDetectionFilter.java:44)
    at java.lang.Thread.run(Thread.java:662)
Caused by: javax.persistence.RollbackException: Error while committing the transaction
    at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:92)
    at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:513)
    ... 60 more
Caused by: org.hibernate.AssertionFailure: Exception releasing cache locks
    at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:791)
    at org.hibernate.engine.spi.ActionQueue.afterTransactionCompletion(ActionQueue.java:329)
    at org.hibernate.internal.SessionImpl.afterTransactionCompletion(SessionImpl.java:626)
    at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.afterTransaction(TransactionCoordinatorImpl.java:146)
    at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.afterTransactionCompletion(JdbcTransaction.java:138)
    at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:184)
    at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:75)
    ... 61 more
Caused by: java.lang.IllegalMonitorStateException: Current thread is not owner of the lock! -> <not-locked>
    at com.hazelcast.concurrent.lock.UnlockOperation.run(UnlockOperation.java:51)
    at com.hazelcast.spi.impl.OperationServiceImpl.doRunOperation(OperationServiceImpl.java:274)
    at com.hazelcast.spi.impl.OperationServiceImpl.access$800(OperationServiceImpl.java:52)
    at com.hazelcast.spi.impl.OperationServiceImpl$RemoteOperationProcessor.run(OperationServiceImpl.java:744)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)
    at com.hazelcast.spi.impl.OperationServiceImpl$OperationThread.run(OperationServiceImpl.java:791)
    at ------ End remote and begin local stack-trace ------.(Unknown Source)
    at com.hazelcast.spi.impl.InvocationImpl$InvocationFuture.resolveResponse(InvocationImpl.java:411)
    at com.hazelcast.spi.impl.InvocationImpl$InvocationFuture.get(InvocationImpl.java:294)
    at com.hazelcast.spi.impl.InvocationImpl$InvocationFuture.get(InvocationImpl.java:286)
    at com.hazelcast.concurrent.lock.proxy.LockProxySupport.unlock(LockProxySupport.java:150)
    at com.hazelcast.map.proxy.MapProxyImpl.unlock(MapProxyImpl.java:238)
    at com.hazelcast.hibernate.distributed.IMapRegionCache.unlock(IMapRegionCache.java:125)
    at com.hazelcast.hibernate.access.ReadWriteAccessDelegate.unlockItem(ReadWriteAccessDelegate.java:65)
    at com.hazelcast.hibernate.region.EntityRegionAccessStrategyAdapter.unlockItem(EntityRegionAccessStrategyAdapter.java:92)
    at org.hibernate.action.internal.EntityUpdateAction.doAfterTransactionCompletion(EntityUpdateAction.java:295)
    at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:784

任何人都可以帮助或提供意见。

提前致谢

0 个答案:

没有答案