oracle / oracle-r2dbc

R2DBC Driver for Oracle Database
https://oracle.com
Other
197 stars 40 forks source link

Workaround ResultSet memory leak #88

Closed Michael-A-McMahon closed 2 years ago

Michael-A-McMahon commented 2 years ago

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 commented 2 years ago

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

Michael-A-McMahon commented 2 years ago

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

sgtcortez commented 2 years ago

thank u

htejwani commented 1 year ago

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

Michael-A-McMahon commented 1 year ago

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

Michael-A-McMahon commented 1 year ago

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/