Skip to content

Comments

Fixed race condition connecting to the wrong SQLServer host in configurable IPv6#1965

Merged
tkyc merged 6 commits intomicrosoft:mainfrom
mmimica:fix_wrong_host
Dec 14, 2022
Merged

Fixed race condition connecting to the wrong SQLServer host in configurable IPv6#1965
tkyc merged 6 commits intomicrosoft:mainfrom
mmimica:fix_wrong_host

Conversation

@mmimica
Copy link
Contributor

@mmimica mmimica commented Nov 11, 2022

Fix #1964 by not having a static field at all. It was cleared each time anyway.

ulvii and others added 6 commits December 3, 2020 12:37
Release | Merge dev to master for 9.1.1-preview release
# Conflicts:
#	CHANGELOG.md
#	README.md
#	azure-pipelines.yml
#	build.gradle
#	mssql-jdbc_auth_LICENSE
#	pom.xml
#	src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
#	src/main/java/com/microsoft/sqlserver/jdbc/SQLJdbcVersion.java
#	src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
#	src/main/java/com/microsoft/sqlserver/jdbc/SQLServerMSAL4JUtils.java
#	src/samples/adaptive/pom.xml
#	src/samples/alwaysencrypted/pom.xml
#	src/samples/azureactivedirectoryauthentication/pom.xml
#	src/samples/connections/pom.xml
#	src/samples/constrained/pom.xml
#	src/samples/dataclassification/pom.xml
#	src/samples/datatypes/pom.xml
#	src/samples/resultsets/pom.xml
#	src/samples/sparse/pom.xml
#	src/test/java/com/microsoft/sqlserver/jdbc/TestResource.java
#	src/test/java/com/microsoft/sqlserver/jdbc/databasemetadata/DatabaseMetaDataTest.java
#	src/test/java/com/microsoft/sqlserver/jdbc/fedauth/ErrorMessageTest.java
@lilgreenbird
Copy link
Contributor

thanks for the contribution @mmimica, could you please add a test for this?

@mmimica
Copy link
Contributor Author

mmimica commented Nov 15, 2022

I can't. A unit test would require a larger refactoring as host lookup code would need to be stubbed, and two servers in the test environment.
Besides, race-conditions are generally not reproducible. Correctness is assured by guarding the shared state (to be fair, there was an attempt there to guard it with a lock, but the lock is too fine-grained to be effective) and by not having needles shared state in the first place.

@lilgreenbird lilgreenbird added this to the 12.2.0 milestone Dec 8, 2022
@tkyc tkyc merged commit 128be37 into microsoft:main Dec 14, 2022
tkyc pushed a commit that referenced this pull request Dec 14, 2022
* Merge dev to master for 9.2.0 release (#1506)

Merge dev to master for 9.2.0 release (#1506)

* fix merge

* Fix #1964 by not having a static field at all. It was cleared each time anyway.

* refactor a bit

Co-authored-by: ulvii <v-ulibra@microsoft.com>
Co-authored-by: Peter Bae <v-hyba@microsoft.com>
Co-authored-by: Milan Mimica <milan.mimica@infobip.com>
tkyc pushed a commit that referenced this pull request Dec 28, 2022
* Merge dev to master for 9.2.0 release (#1506)

Merge dev to master for 9.2.0 release (#1506)

* fix merge

* Fix #1964 by not having a static field at all. It was cleared each time anyway.

* refactor a bit

Co-authored-by: ulvii <v-ulibra@microsoft.com>
Co-authored-by: Peter Bae <v-hyba@microsoft.com>
Co-authored-by: Milan Mimica <milan.mimica@infobip.com>
tkyc pushed a commit that referenced this pull request Dec 29, 2022
* Merge dev to master for 9.2.0 release (#1506)

Merge dev to master for 9.2.0 release (#1506)

* fix merge

* Fix #1964 by not having a static field at all. It was cleared each time anyway.

* refactor a bit

Co-authored-by: ulvii <v-ulibra@microsoft.com>
Co-authored-by: Peter Bae <v-hyba@microsoft.com>
Co-authored-by: Milan Mimica <milan.mimica@infobip.com>
tkyc added a commit that referenced this pull request Dec 29, 2022
* Merge dev to master for 9.2.0 release (#1506)

Merge dev to master for 9.2.0 release (#1506)

* fix merge

* Fix #1964 by not having a static field at all. It was cleared each time anyway.

* refactor a bit

Co-authored-by: ulvii <v-ulibra@microsoft.com>
Co-authored-by: Peter Bae <v-hyba@microsoft.com>
Co-authored-by: Milan Mimica <milan.mimica@infobip.com>

Co-authored-by: Milan Mimica <milan.mimica@gmail.com>
Co-authored-by: ulvii <v-ulibra@microsoft.com>
Co-authored-by: Peter Bae <v-hyba@microsoft.com>
Co-authored-by: Milan Mimica <milan.mimica@infobip.com>
@lilgreenbird lilgreenbird changed the title Fix connecting to the wrong SQLServer host Fixed race condition connecting to the wrong SQLServer host in configurable IPv6 Jan 26, 2023
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.

The driver connects to the wrong SQLServer host

6 participants