cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Unable to catch TransientException

Hi,

I have facing a issue when I am trying to catch TransientException exception for below code:

StatementResult result = runQuery(sb.toString(), entity.getAllProperties());
Record record = null;
try {
int retryCnt = 0;
while(retryCnt++ <= MAX_NEO4J_RETRY_CNT) {
try {
record = result.single();
break;
}catch (TransientException e) {
if(retryCnt >= MAX_NEO4J_RETRY_CNT) {
logger.warn("Giving up entity query " + entity.getSureName() + ", after " + retryCnt + " retries");
throw e;
}
logger.warn("Retrying Entity query for : " + entity.getSureName());
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e1) {
}
}
}
}catch (NoSuchRecordException e) {
return entity;
}

record = result.single(); throws TransientException and the above code catches it. However retry code never gets executed as I don’t the log messages. Attaching the exception trace, I can see that TransientException is getting suppressed. Can you please help me if there any other way to handle this exception.

Regards
Saurabh
Neo4J.txt (7.6 KB)

3 REPLIES 3

Hi

I changed the catch to handle all Exception than also retry code is not executed. Can someone please help on how to make this work.

Regards
Saurabh

I don't really see how the code you share matches the stack trace you provided.
In particular:

org.neo4j.driver.v1.exceptions.TransientException: ForsetiClient[70] can't acquire ExclusiveLock{owner=ForsetiClient[9]} on NODE(107292252), because holders of that lock are waiting for ForsetiClient[70].
 Wait list:ExclusiveLock[
Client[9] waits for [14,70]]
	at org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:123)
	at org.neo4j.driver.internal.ExplicitTransaction.close(ExplicitTransaction.java:117)
	at com.nokia.mdf.sure.neo.repo.ScopingDataSourceImpl.endTransactionScope(ScopingDataSourceImpl.java:199) <------- your code ends here
	at com.nokia.mdf.sure.neo.repo.SureDBN4jCommand.executeWrite(SureDBN4jCommand.java:121)
	at com.nokia.mdf.sure.neo.repo.SureDBN4jCommand.execute(SureDBN4jCommand.java:222)
	at com.nokia.oss.sure.proc.init.NeoExecute.execute(NeoExecute.java:27)

What's happening at com.nokia.mdf.sure.neo.repo.ScopingDataSourceImpl.java on line 199?
Is it surrounded by a try-catch block with TransientException?

Hi,

Thanks for your, below stack trace matches my code. This stack trace is at the end of file.

Regards
Saurabh
Suppressed: org.neo4j.driver.internal.util.ErrorUtil$InternalExceptionCause
at org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:123)
at org.neo4j.driver.internal.InternalStatementResult.blockingGet(InternalStatementResult.java:134)
at org.neo4j.driver.internal.InternalStatementResult.single(InternalStatementResult.java:81)
at com.nokia.mdf.sure.neo.dao.GenericDaoExt.checkAssociationEntity(GenericDaoExt.java:1842)
at com.nokia.oss.sure.proc.init.NeoDBActions$10.doExecute(NeoDBActions.java:355)
at com.nokia.mdf.sure.neo.repo.SureDBN4jCommand.executeWrite(SureDBN4jCommand.java:87)
... 13 more