Skip to content

feat: implement eager close ResultSet mode (enabled by default)#510

Draft
Copilot wants to merge 9 commits into
mainfrom
copilot/add-optional-materialized-resultset-mode
Draft

feat: implement eager close ResultSet mode (enabled by default)#510
Copilot wants to merge 9 commits into
mainfrom
copilot/add-optional-materialized-resultset-mode

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

Implements the eager close ResultSet mode. When enabled (default), OJP proactively releases the DB-side cursor after a forward-only ResultSet is fully read by the client.

Enabled by default — set ojp.resultset.eagerClose.enabled=false to disable.

Changes

ServerConfiguration

  • New property: ojp.resultset.eagerClose.enabled (default: true)
  • Logged at startup in the configuration summary

ResultSetHelper.handleResultSet()

  • After all rows are streamed and the gRPC response is completed, eagerly closes the ResultSet cursor when all conditions are met:
    1. Eager close is enabled
    2. Database is not DB2 (DB2 requires post-iteration metadata access via session attributes)
    3. Not in row-by-row / LOB mode (SQL Server / DB2 LOB path)
    4. No LOBs or binary streams registered in the session
    5. Not an XA session
    6. ResultSet is TYPE_FORWARD_ONLY (scrollable RS must stay open for client-side navigation methods)
  • The auto-commit check (not inside a transaction) is applied as a final runtime guard
  • The session, Statement, and pooled connection are not terminated — they remain alive for the full JDBC connection lifecycle (multi-statement connections, getMoreResults(), metadata access, etc.)
  • Conditions are encapsulated in a shouldEagerClose() helper method

SessionManagerImpl

  • Resource getters (getResultSet, getStatement, getPreparedStatement, getCallableStatement, getAttr, registerAttr) are null-safe, returning null/no-op when the session has already been terminated

CallResourceAction

  • When the resolved resource is null, returns an empty success response so that subsequent JDBC close() calls from the client do not surface as errors in the application

Compatibility

Scenario Behaviour
eagerClose.enabled=true (default), TYPE_FORWARD_ONLY RS, no LOBs, auto-commit, non-XA, non-DB2 RS cursor closed immediately; session, Statement and connection preserved
eagerClose.enabled=true, scrollable RS / LOBs present / in transaction / XA / DB2 Normal session lifecycle — no early release
eagerClose.enabled=false Normal session lifecycle — no early release

Tests

Six unit tests in EagerCloseResultSetModeTest:

  1. shouldNotCloseResultSetEarlyWhenEagerCloseDisabled — mode off: RS left open
  2. shouldCloseForwardOnlyResultSetAfterFullyReadWithNoLobsAndAutoCommit — forward-only RS cursor closed; session remains alive
  3. shouldAllowClientCloseCallAfterEagerCloseclose() on an eagerly-closed RS returns success
  4. shouldCloseResultSetAfterEagerClose — RS is closed; Statement is not closed
  5. shouldNotReleaseConnectionWhenInsideActiveTransaction — no eager close when autoCommit=false
  6. shouldNotEagerCloseWhenSessionHasLobs — no eager close when LOBs are registered

All 727 existing server tests pass. Checkstyle passes.

@rrobetti
Copy link
Copy Markdown
Contributor

@copilot change to be enabled by default.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

@copilot change to be enabled by default.

Done in 63d354f. DEFAULT_MATERIALIZED_MODE_ENABLED is now true — early resource release is the default behavior. Set ojp.resultset.materializedMode.enabled=false to revert to the strict JDBC lifecycle.

Copilot AI changed the title feat: implement optional materialized ResultSet mode feat: implement materialized ResultSet mode (enabled by default) May 14, 2026
@rrobetti
Copy link
Copy Markdown
Contributor

@copilot appears to be closing the ResultSet before it is finished reading, also might need to have special treatment for LOBs/binary streams

Error: Failures:
Error: H2OpenLoopLatencyIntegrationTest.shouldLogLatencyReportForOpenLoopH2Workload:134 Unexpected SQL workload exceptions. See FAILURE SUMMARY section in report. ==> expected: <0> but was: <1991>
Error: Errors:
Error: BinaryStreamIntegrationTest.createAndReadingLargeBinaryStreamSuccessful:165 » SQL Connection not found for this sessionInfo
Error: BlobIntegrationTest.createAndReadingBLOBsSuccessful:126 » SQL Connection not found for this sessionInfo
Error: BlobIntegrationTest.creatingAndReadingLargeBLOBsSuccessful:178 » SQL Connection not found for this sessionInfo
Error: H2MultipleTypesIntegrationTest.calendarOverloadsWorkForLocalDateTimeColumns:359 » SQL Unable to terminate session: Cannot invoke "java.sql.Connection.getAutoCommit()" because the return value of "org.openjproxy.grpc.server.Session.getConnection()" is null
Error: H2MultipleTypesIntegrationTest.typesCoverageTestSuccessful:259 » SQL Connection not found for this sessionInfo
Error: H2PreparedStatementExtensiveTests.testExecutionAndBatchMethods:167 » SQL Connection not found for this sessionInfo
Error: H2PreparedStatementExtensiveTests.testResultAndGeneratedKeysMethods:280 » SQL Connection not found for this sessionInfo
Error: H2SessionAffinityIntegrationTest.testComplexTemporaryTableOperations:144 » SQL Unable to terminate session: Cannot invoke "java.sql.Connection.getAutoCommit()" because the return value of "org.openjproxy.grpc.server.Session.getConnection()" is null
Error: H2SessionAffinityIntegrationTest.testTemporaryTableSessionAffinity:80 » SQL Unable to terminate session: Cannot invoke "java.sql.Connection.getAutoCommit()" because the return value of "org.openjproxy.grpc.server.Session.getConnection()" is null
Error: H2StatementExtensiveTests.testExecute:164 » SQL Connection not found for this sessionInfo
Error: H2StatementExtensiveTests.testGetMoreResults:174 » SQL Connection not found for this sessionInfo
Error: H2StatementExtensiveTests.testGetMoreResultsWithCurrent:245 » SQL Connection not found for this sessionInfo
Error: HydratedLobValidationTest.testHydratedBinaryStreamBehavior:177 » SQL Connection not found for this sessionInfo
Error: HydratedLobValidationTest.testHydratedLobBehavior:130 » SQL Connection not found for this sessionInfo
Error: MultiDataSourceIntegrationTest.testBackwardCompatibilityWithDefaultDataSource:171->createAndTestTable:271 » SQL Connection not found for this sessionInfo
Error: MultiDataSourceIntegrationTest.testCrossDatabaseTableAccessThrowsException:191->createAndTestTable:271 » SQL Connection not found for this sessionInfo
Error: MultiDataSourceIntegrationTest.testFailFastForMissingDataSource:150->createAndTestTable:271 » SQL Connection not found for this sessionInfo
Error: MultiDataSourceIntegrationTest.testMultipleDataSourcesForDifferentDatabases:109->createAndTestTable:271 » SQL Connection not found for this sessionInfo
Error: MultiDataSourceIntegrationTest.testMultipleDataSourcesForSingleDatabaseSingleUser:73->createAndTestTable:271 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ResultSetMetaDataExtensiveTests.tearDown:54 » SQL Unable to terminate session: Cannot invoke "java.sql.Connection.getAutoCommit()" because the return value of "org.openjproxy.grpc.server.Session.getConnection()" is null
Error: ResultSetTest.testAdvancedNavigation:179 » SQL The object is already closed [90007-232]
Error: ResultSetTest.testCursorPositionMethods:157 » SQL The object is already closed [90007-232]
Error: ResultSetTest.tearDown:80 » SQL Unable to terminate session: Cannot invoke "java.sql.Connection.getAutoCommit()" because the return value of "org.openjproxy.grpc.server.Session.getConnection()" is null
Error: ResultSetTest.tearDown:80 » SQL Unable to terminate session: Cannot invoke "java.sql.Connection.getAutoCommit()" because the return value of "org.openjproxy.grpc.server.Session.getConnection()" is null
Error: ResultSetTest.testNavigationMethods:89 » SQL The object is already closed [90007-232]
Error: ResultSetTest.testNullHandling:129 » SQL Connection not found for this sessionInfo
Error: ResultSetTest.testUpdateMethods:140 » SQL The object is already closed [90007-232]
Error: ResultSetTest.testWarnings:171 » SQL The object is already closed [90007-232]
[INFO]
Error: Tests run: 1011, Failures: 1, Errors: 34, Skipped: 682

@rrobetti
Copy link
Copy Markdown
Contributor

@copilot lets use a different name it should not be materialized result set, should be something like eagerly close result sets.

…n materialized mode

Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/ae782555-9b2c-4b4c-b0ec-83db007207bb

Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

@copilot appears to be closing the ResultSet before it is finished reading, also might need to have special treatment for LOBs/binary streams

Error: Failures:
...

Fixed in 40ea888. The root causes were three overly-aggressive releases in releaseMaterializedResources:

  1. Connection release (Session.releaseConnection()) — set connection = null mid-session, so any subsequent SQL operation on the same JDBC session (second query, LOB read, session teardown) threw "Connection not found" or NPE on getAutoCommit().
  2. rs.close() after streaming — broke scrollable RS navigation (first(), last(), previous()), warnings, and update methods that the client calls after next() completes.
  3. stmt.close() after streaming — broke getMoreResults() and other statement-level operations.

All three early-release paths have been removed. The feature flag (ojp.resultset.materializedMode.enabled=true) now only controls the metadata pre-snapshot (safe, and already required by DB2). The LOB/binary-stream special cases are automatically safe because the RS and Statement remain open.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-0fe3065af824c7c2/dbs/java/working/files-to-index13741828708860953984.list --sourceArchiveDir=/tmp/codeql-scratch-0fe3065af824c7c2/dbs/java/src --outputDir=/tmp/codeql-scratch-0fe3065af824c7c2/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

@copilot lets use a different name it should not be materialized result set, should be something like eagerly close result sets.

Done in 26548d1. Renamed throughout:

  • Property: ojp.resultset.materializedMode.enabledojp.resultset.eagerClose.enabled
  • Constant: DEFAULT_MATERIALIZED_MODE_ENABLEDDEFAULT_EAGER_CLOSE_ENABLED
  • Method: isMaterializedModeEnabled()isEagerCloseEnabled()
  • Test class: MaterializedResultSetModeTestEagerCloseResultSetModeTest (with updated test method names)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 999.999.999.999
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire/surefirebooter-20260514092833940_3.jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire 2026-05-14T09-28-33_880-jvmRun1 surefire-20260514092833940_1tmp surefire_0-20260514092833940_2tmp (dns block)
  • invalid-ip
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire/surefirebooter-20260514092833940_3.jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire 2026-05-14T09-28-33_880-jvmRun1 surefire-20260514092833940_1tmp surefire_0-20260514092833940_2tmp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title feat: implement materialized ResultSet mode (enabled by default) feat: implement eager close ResultSet mode (enabled by default) May 14, 2026
@rrobetti
Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

@copilot resolve the merge conflicts in this pull request

Done in c580aec. There was one conflict in ServerConfiguration.java — main added resultsetRowsPerBlock while our branch added eagerCloseEnabled. Both fields and their getters are preserved in the merge. All 726 server tests pass.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 999.999.999.999
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire/surefirebooter-20260514093922995_3.jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire 2026-05-14T09-39-22_757-jvmRun1 surefire-20260514093922995_1tmp surefire_0-20260514093922995_2tmp (dns block)
  • invalid-ip
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire/surefirebooter-20260514093922995_3.jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire 2026-05-14T09-39-22_757-jvmRun1 surefire-20260514093922995_1tmp surefire_0-20260514093922995_2tmp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Contributor

@rrobetti rrobetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot if the result set does not have LOBs/binary streams, it is not part of a transaction and was fully read, close it and close the connection and session.

Copilot AI and others added 2 commits May 14, 2026 10:03
…LOBs and auto-commit

When eagerClose is enabled and the ResultSet is fully read with:
- no LOBs/binary streams registered in the session
- not inside a transaction (auto-commit = true)
- not an XA session
- not DB2 (which requires post-iteration metadata lookups from session)

... the server now closes the RS, closes the Statement, and terminates
the session (returning the pooled connection immediately).

SessionManagerImpl getters are now null-safe so that subsequent
close() calls from the JDBC client on an already-terminated session
return an empty success response rather than NPE-ing.

CallResourceAction handles null resources (eagerly-closed sessions)
by returning an empty success response, preventing JDBC close() calls
from surfacing as errors in the application.

Tests updated: 6 unit tests covering disabled mode, eager termination,
client close after eager close, RS/Statement closure, active-transaction
guard, and LOBs guard."

Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/0b450291-612a-4892-a955-533a837b2e3a

Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

@copilot if the result set does not have LOBs/binary streams, it is not part of a transaction and was fully read, close it and close the connection and session.

Done in fc05dd1. After a ResultSet is fully read, when eagerClose.enabled=true and all five guards pass — no LOBs registered in the session, auto-commit (no active transaction), non-XA, non-DB2, and no row-by-row/LOB mode — the server now closes the RS, closes the Statement, and terminates the session (returning the pooled connection immediately).

To prevent the JDBC driver's subsequent rs.close() / stmt.close() calls from surfacing as errors after the session is already gone, SessionManagerImpl getters are now null-safe and CallResourceAction returns an empty success response for null resources.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 999.999.999.999
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire/surefirebooter-20260514100237071_3.jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire 2026-05-14T10-02-37_018-jvmRun1 surefire-20260514100237071_1tmp surefire_0-20260514100237071_2tmp ACCEPT (dns block)
  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-0fe3065af824c7c2/dbs/java/working/files-to-index14898585563228575290.list --sourceArchiveDir=/tmp/codeql-scratch-0fe3065af824c7c2/dbs/java/src --outputDir=/tmp/codeql-scratch-0fe3065af824c7c2/dbs/java/trap/java (dns block)
  • invalid-ip
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire/surefirebooter-20260514100237071_3.jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire 2026-05-14T10-02-37_018-jvmRun1 surefire-20260514100237071_1tmp surefire_0-20260514100237071_2tmp ACCEPT (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from rrobetti May 14, 2026 10:08
@rrobetti
Copy link
Copy Markdown
Contributor

@copilot why are these still failing? I assumed in the path you implemented was safe to eagerly close the result set

[INFO] Results:
[INFO]
Error: Failures:
Error: H2OpenLoopLatencyIntegrationTest.shouldLogLatencyReportForOpenLoopH2Workload:134 Unexpected SQL workload exceptions. See FAILURE SUMMARY section in report. ==> expected: <0> but was: <1994>
Error: Errors:
Error: BinaryStreamIntegrationTest.createAndReadingLargeBinaryStreamSuccessful:165 » SQL Connection not found for this sessionInfo
Error: H2MultipleTypesIntegrationTest.calendarOverloadsWorkForLocalDateTimeColumns:357 » SQL Connection not found for this sessionInfo
Error: H2MultipleTypesIntegrationTest.typesCoverageTestSuccessful:259 » SQL Connection not found for this sessionInfo
Error: H2PreparedStatementExtensiveTests.testResultAndGeneratedKeysMethods:280 » SQL Connection not found for this sessionInfo
Error: H2StatementExtensiveTests.testExecute:164 » SQL Connection not found for this sessionInfo
Error: H2StatementExtensiveTests.testGetMoreResults:174 » SQL Connection not found for this sessionInfo
Error: H2StatementExtensiveTests.testGetMoreResultsWithCurrent:245 » SQL Connection not found for this sessionInfo
Error: HydratedLobValidationTest.testHydratedBinaryStreamBehavior:177 » SQL Connection not found for this sessionInfo
Error: HydratedLobValidationTest.testHydratedLobBehavior:130 » SQL Connection not found for this sessionInfo
Error: MultiDataSourceIntegrationTest.testBackwardCompatibilityWithDefaultDataSource:171->createAndTestTable:271 » SQL Connection not found for this sessionInfo
Error: MultiDataSourceIntegrationTest.testCrossDatabaseTableAccessThrowsException:191->createAndTestTable:271 » SQL Connection not found for this sessionInfo
Error: MultiDataSourceIntegrationTest.testFailFastForMissingDataSource:150->createAndTestTable:271 » SQL Connection not found for this sessionInfo
Error: MultiDataSourceIntegrationTest.testMultipleDataSourcesForDifferentDatabases:109->createAndTestTable:271 » SQL Connection not found for this sessionInfo
Error: MultiDataSourceIntegrationTest.testMultipleDataSourcesForSingleDatabaseSingleUser:73->createAndTestTable:271 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ReadMultipleBlocksOfDataIntegrationTest.multiplePagesOfRowsResultSetSuccessful:69 » SQL Connection not found for this sessionInfo
Error: ResultSetMetaDataExtensiveTests.testAllResultSetMetaDataMethods:66 » NullPointer Cannot invoke "java.lang.Boolean.booleanValue()" because the return value of "org.openjproxy.jdbc.ResultSetMetaData.retrieveMetadataAttribute(com.openjproxy.grpc.CallType, String, java.lang.Integer, java.lang.Class)" is null
Error: ResultSetTest.testAdvancedNavigation:179 » NullPointer Cannot invoke "java.lang.Boolean.booleanValue()" because the return value of "org.openjproxy.jdbc.RemoteProxyResultSet.callProxy(com.openjproxy.grpc.CallType, String, java.lang.Class, java.util.List)" is null
Error: ResultSetTest.testCursorPositionMethods:157 » NullPointer Cannot invoke "java.lang.Boolean.booleanValue()" because the return value of "org.openjproxy.jdbc.RemoteProxyResultSet.callProxy(com.openjproxy.grpc.CallType, String, java.lang.Class)" is null
Error: ResultSetTest.testNavigationMethods:89 » NullPointer Cannot invoke "java.lang.Boolean.booleanValue()" because the return value of "org.openjproxy.jdbc.RemoteProxyResultSet.callProxy(com.openjproxy.grpc.CallType, String, java.lang.Class, java.util.List)" is null
Error: ResultSetTest.testNullHandling:129 » SQL Connection not found for this sessionInfo
Error: ResultSetTest.testUpdateMethods:148 » SQL Connection not found for this sessionInfo
[INFO]
Error: Tests run: 1011, Failures: 1, Errors: 26, Skipped: 682

…t and connection preserved

Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/df722726-7fbd-44bb-8b35-f63c291fbbc9

Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

@copilot why are these still failing? I assumed in the path you implemented was safe to eagerly close the result set

[INFO] Results:
...

Fixed in 1f85306. The path was not safe because terminateSession() removed the session from the map entirely, which broke any JDBC connection that executed more than one query. Three changes were made:

  1. Removed terminateSession() — the session (and its DB connection) must stay alive; JDBC connections are routinely reused for multiple statements.
  2. Removed stmt.close() — the Statement must stay open for getMoreResults() and other post-RS operations.
  3. Added TYPE_FORWARD_ONLY guard — only close the RS cursor for forward-only result sets; scrollable RS (used by ResultSetTest with TYPE_SCROLL_INSENSITIVE) must remain open so the client can call first(), last(), absolute(), etc.

What the eager close now does: for a forward-only RS with no LOBs, in auto-commit, non-XA mode — the DB-side cursor is freed immediately after the stream completes rather than waiting for conn.close(). The session, connection, and statement stay alive for further use.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 999.999.999.999
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire/surefirebooter-20260514103910757_3.jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire 2026-05-14T10-39-10_699-jvmRun1 surefire-20260514103910757_1tmp surefire_0-20260514103910757_2tmp (dns block)
  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-0fe3065af824c7c2/dbs/java/working/files-to-index487420112327647910.list --sourceArchiveDir=/tmp/codeql-scratch-0fe3065af824c7c2/dbs/java/src --outputDir=/tmp/codeql-scratch-0fe3065af824c7c2/dbs/java/trap/java xy/jdbc/OracleConnectionExtensiveTests.java xy/jdbc/PerformanceMetricsTest.java xy/jdbc/H2Databa/bin/sh xy/jdbc/Postgres-c xy/jdbc/H2Multipcd &#39;/home/REDACTED/work/ojp/ojp/ojp-datasource-hikari&#39; &amp;&amp; &#39;/usr/lib/jvm/temurin-21-jdk-amd64/bin/java&#39; &#39;-jar&#39; &#39;/home/REDACTED/work/ojp/ojp/ojp-datasource-hikari/target/surefire/surefirebooter-20260514103851076_24.jar&#39; &#39;/home/REDACTED/work/ojp/ojp /ojp-datasource xy/j�� xy/jdbc/CockroachDBConnectionExtensiveTests.java xy/jdbc/OracleXAIntegrationTest.java rgo/bin/git (dns block)
  • invalid-ip
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire/surefirebooter-20260514103910757_3.jar /home/REDACTED/work/ojp/ojp/ojp-server/target/surefire 2026-05-14T10-39-10_699-jvmRun1 surefire-20260514103910757_1tmp surefire_0-20260514103910757_2tmp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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.

2 participants