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

AsyncSQLConnectionImpl commits dirty data on close #155

Open
jim-mclaugh opened this issue May 18, 2019 · 0 comments
Open

AsyncSQLConnectionImpl commits dirty data on close #155

jim-mclaugh opened this issue May 18, 2019 · 0 comments

Comments

@jim-mclaugh
Copy link

It is possible for the AsyncSQLConnectionImpl class to commit dirty data on close. Most connection pool connection proxies detect if there are uncommitted statements (eg dirty state) when close is called on the connection and rollback those statements before returning the connection to the pool. AsyncSQLConnectionImpl takes the opposite approach and commits the dirty state before returning the connection to the pool.

In a reactive-streams context, a subscriber can abruptly dispose of a subscription without completion or error notifications occurring. To prevent resource leakage, such as database connection leaks, it is common to perform resource cleanup in doFinally since it will always be called when a stream is terminated whether that is due to completion, error, or disposal. If close is called in doFinally then a transaction might get committed even though not all the participating statements have executed.

To fix this, if dirty state is detected when close is called, rollback should be executed on the connection instead of commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant