Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE during transaction rollback when custom query fails [DATAGRAPH-997] #1559

Closed
spring-projects-issues opened this issue May 18, 2017 · 0 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented May 18, 2017

Konstantin Lutovich opened DATAGRAPH-997 and commented

Hello,

I'm facing an issue where Neo4jTransactionManager fails to rollback transaction after runtime exception in a custom Cypher query. Attached github repository contains a project to reproduce the problem.

It contains a repository which extends GraphRepository and adds a single method with a custom query MATCH (m:Movie) WHERE m.title = '' RETURN m AS movie, 10/0 AS other. This query obviously generates a "division by zero" runtime exception. However I can also see NPE stacktrace. It seems to occur because Neo4jTransactionManager tries to rollback transaction that has already been rolled back by OGM code in BoltResponse#next().

Division by zero in this example is artificial, in reality queries can fail in many different ways at runtime (deadlocks, type errors, etc.).

Seen stacktrace:

Exception in thread "main" java.lang.NullPointerException
at org.springframework.data.neo4j.transaction.Neo4jTransactionManager.doRollback(Neo4jTransactionManager.java:275)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:853)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:830)
at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:522)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:286)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656)
at org.neo4j.services.MovieService$$EnhancerBySpringCGLIB$$b8f1a8e3.findByTitle(<generated>)
at org.neo4j.SampleMovieApplication.main(SampleMovieApplication.java:30)

Affects: 4.2.3 (Ingalls SR3)

Reference URL: https://github.com/lutovich/sdn-test

Referenced from: commits 2a4df87, 1e39f81

Backported to: 4.2.8 (Ingalls SR8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant