Skip to content

Workaround ResultSet memory leak #88

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 3, 2022
Merged

Conversation

Michael-A-McMahon
Copy link
Member

Fixes #85

Changes in this branch work around a memory leak caused by Oracle JDBC bug 34545179.

The workaround is to call getMoreResults(CLOSE_ALL_RESULTS) before closing the JDBC statement. This call has Oracle JDBC remove all elements from the ArrayDeque used internally to store ResultSet objects.

I don't have an automated test for this as it would require a way to WeakReference the ResultSet and verify that it gets garbage collected. Oracle R2DBC does not expose the ResultSet object to user code, so I can't access that with test code.

I've verified this by setting a debug breakpoint that triggers on the condition of Oracle JDBC's ArrayDeque not being empty when the statement is closed. I was able to run the full test suite without triggering this breakpoint, so I am confident that this fix will work.

@sgtcortez
Copy link

Hi @Michael-A-McMahon do you have any plan to merge this next week?

@Michael-A-McMahon
Copy link
Member Author

Yes. There are a few PRs now that should be reviewed. I'll reach out to people how can review and merge.

@sgtcortez
Copy link

thank u

@jeandelavarene jeandelavarene merged commit e8fc172 into main Sep 3, 2022
@jeandelavarene jeandelavarene deleted the 85-more-results-leak branch September 3, 2022 14:58
@htejwani
Copy link

Can you please release the version with this fix on maven central

@Michael-A-McMahon
Copy link
Member Author

I suspect a Maven Central release will happen soon, possibly by the end of today. I'll keep you updated.

@Michael-A-McMahon
Copy link
Member Author

Fix is available in 1.1.0, which is now available in the Maven Central Repository:
https://repo1.maven.org/maven2/com/oracle/database/r2dbc/oracle-r2dbc/1.1.0/

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory Leak Suspect in ForwardOnlyResultSet
4 participants