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

Fix lock issues around disableSSL and IOBuffer #2295

Merged
merged 8 commits into from
Jan 17, 2024
Merged

Conversation

Jeffery-Wasty
Copy link
Contributor

@Jeffery-Wasty Jeffery-Wasty commented Jan 11, 2024

When migrating from synchronized keyword to locks, any method that used synchronized(this) was then locked using the same lock declared at the top of TDSChannel. This is not correct as most of the synchronzed(this) methods were also in an inner class, but disableSSL was not. Therefore, disableSSL should have a separate lock. This resolves the deadlock issues found in #2265 and #2288.

David-Engel
David-Engel previously approved these changes Jan 11, 2024
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.

I scanned the previous loom PR again and this looks like the complete fix to me. The only other suggestion I might make is to rename the lock variable introduced in the original PR in IOBuffer's TDSReader class to tdsReaderLock to make its scope clear for future developers.

src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java Outdated Show resolved Hide resolved
@Jeffery-Wasty Jeffery-Wasty added this to the 12.6.0 milestone Jan 11, 2024
@Jeffery-Wasty Jeffery-Wasty merged commit 5f71d60 into main Jan 17, 2024
22 checks passed
@Jeffery-Wasty Jeffery-Wasty deleted the deadlockFix branch January 17, 2024 21:13
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
5 participants