Skip to content

Conversation

@lutovich
Copy link
Contributor

@lutovich lutovich commented Jan 9, 2018

Connection error can happen while transaction is executing. Closing transaction after such error should not perform rollback because connection is dead and database has cleaned up all resources.

Previously close operation tried to perform rollback and failed with same ServiceUnavailable exception as the unsuccessful #run(). Error thrown from #close() has to be added as a suppressed error to the one thrown from #run(), when used in try-with-resources block. So code attempted to add error to itself as suppressed. This resulted in an IllegalArgumentException.

This PR fixes the problem by making #close() not perform a rollback after a fatal connection error.

Connection error can happen while transaction is executing. Closing
transaction after such error should not perform rollback because
connection is dead and database has cleaned up all resources.

Previously close operation tried to perform rollback and failed with
same `ServiceUnavailable` exception as the unsuccessful `#run()`. Error
thrown from `#close()` has to be added as a suppressed error to the one
thrown from `#run()`, when used in try-with-resources block. So code
attempted to add error to itself as suppressed. This resulted in an
`IllegalArgumentException`.

This commit fixes the problem by making `#close()` not perform a
rollback after a fatal connection error.
New condition is the same as old one by reads a bit better.
@lutovich lutovich requested a review from zhenlineo January 9, 2018 13:32
@lutovich lutovich merged commit a150643 into neo4j:1.5 Jan 16, 2018
@lutovich lutovich deleted the 1.5-tx-close-err branch January 16, 2018 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant