Skip to content

Invalidate existing enclave session during connection (re)connect #2638

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 7 commits into from
May 8, 2025

Conversation

machavan
Copy link
Contributor

Description:

For AE with secure enclave, the driver connections receives an error 33195 - Internal enclave error. Enclave was provided with an invalid session handle. For more information, contact Customer Support Services, post failovers ( in case of Always On setup).

This could be happening because of driver using existing enclave session from the enclaveCache in the driver.

This fix invalidates the existing enclave session as part of the connect method.

@github-project-automation github-project-automation bot moved this to In progress in MSSQL JDBC Mar 26, 2025
@machavan machavan changed the title Invalidate existing enclave session in during (re)connect Invalidate existing enclave session during connection (re)connect Mar 26, 2025
Copy link

codecov bot commented Mar 26, 2025

Codecov Report

Attention: Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 51.64%. Comparing base (f26f90c) to head (ac3be89).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
.../microsoft/sqlserver/jdbc/SQLServerConnection.java 33.33% 3 Missing and 1 partial ⚠️
...oft/sqlserver/jdbc/SQLServerPreparedStatement.java 0.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2638      +/-   ##
============================================
+ Coverage     51.63%   51.64%   +0.01%     
+ Complexity     4014     4008       -6     
============================================
  Files           147      147              
  Lines         33762    33772      +10     
  Branches       5641     5644       +3     
============================================
+ Hits          17432    17442      +10     
+ Misses        13893    13869      -24     
- Partials       2437     2461      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@lilgreenbird lilgreenbird left a comment

Choose a reason for hiding this comment

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

need to add test

David-Engel
David-Engel previously approved these changes Apr 28, 2025
Copy link
Collaborator

@David-Engel David-Engel left a comment

Choose a reason for hiding this comment

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

No blockers. One small white space nit and if we can de-dup the code block, that'd be great. Approved with or without the changes.

@machavan
Copy link
Contributor Author

machavan commented May 5, 2025

@machavan machavan merged commit aae6a01 into main May 8, 2025
18 of 19 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Closed/Merged PRs in MSSQL JDBC May 8, 2025
@David-Engel David-Engel added this to the 12.11.0 milestone May 9, 2025
divang pushed a commit that referenced this pull request Jun 13, 2025
)

* Invalidate existing enclave session in during (re)connect

* Added check on logging level

* Added a speculative fix to invalidate enclaveCache on error 33195

* Moved error checking in PreparedStatement doExecute methods

* Added trade for invalidation

* Directly call invalidateEnclaveSessionCache from reconnect
divang pushed a commit that referenced this pull request Jun 13, 2025
)

* Invalidate existing enclave session in during (re)connect

* Added check on logging level

* Added a speculative fix to invalidate enclaveCache on error 33195

* Moved error checking in PreparedStatement doExecute methods

* Added trade for invalidation

* Directly call invalidateEnclaveSessionCache from reconnect
divang added a commit that referenced this pull request Jun 13, 2025
) (#2680)

* Invalidate existing enclave session in during (re)connect

* Added check on logging level

* Added a speculative fix to invalidate enclaveCache on error 33195

* Moved error checking in PreparedStatement doExecute methods

* Added trade for invalidation

* Directly call invalidateEnclaveSessionCache from reconnect

Co-authored-by: Mahendra Chavan <machavan@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed/Merged PRs
Development

Successfully merging this pull request may close these issues.

4 participants