I am using ignite 2.8.1 I have ignite lock that is inside some cron, I use it to run my processing only on single server node.I have 3 server nodes in my app.
And today I've seen some exceptions. Could you explain how it could happens? It seems it happens while unlock(), but it is strange how it could not own the lock if is inside tryLock() ?
<ignite-sys-atomic-cache@default-volatile-ds-group> Lock.unlock() is called in illegal state [callerNodeId=ee0de9a9-5a13-4971-a744-dcc5087fd287, ownerNodeId=a2bba513-9ed7-4dc3-beea-574bf46f0034, callerThreadId=674, ownerThreadId=672, lockState=1]
ant trace:
java.lang.IllegalMonitorStateException: null at org.apache.ignite.internal.processors.datastructures.GridCacheLockImpl$Sync.tryRelease(GridCacheLockImpl.java:446) at
java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1261) at
org.apache.ignite.internal.processors.datastructures.GridCacheLockImpl.unlock(GridCacheLockImpl.java:1258) at com.sa.sm.vp.service.LockUtil.unlock(LockUtil.java:35) at
com.sa.sm.vp.service.content.SessionExpirator.triggerExpirationEvent(SessionExpirator.java:78) at
com.sa.sm.vp.service.content.SessionExpirator$$FastClassBySpringCGLIB$$ac2d1b1f.invoke(<generated>) at
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88) at
io.opentracing.contrib.spring.cloud.scheduled.ScheduledAspect.traceBackgroundThread(ScheduledAspect.java:57) at
sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroun
code:
private IgniteSpringBean igniteSpringBean;
@Scheduled(initialDelay = 20000, fixedDelay = 4000)
@Timed
public void triggerExpirationEvent() {
IgniteLock lock = igniteSpringBean.reentrantLock("PLAYBACK_SESSION", true, true, true);
if (lock.tryLock()) {
try {
// do my work in separate thread
// timeout
try {
TimeUnit.MICROSECONDS.sleep(2000);
} catch (InterruptedException e) {
log.warn("Failed to sleep ", e);
}
}
} finally {
lock.unlock()
}
}
}