Skip to content

Fixed error when connection killed during transaction #454

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

Merged
merged 2 commits into from
Jan 16, 2018

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