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

The driver connects to the wrong SQLServer host #1964

Closed
mmimica opened this issue Nov 11, 2022 · 1 comment · Fixed by #1965
Closed

The driver connects to the wrong SQLServer host #1964

mmimica opened this issue Nov 11, 2022 · 1 comment · Fixed by #1965
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly.
Milestone

Comments

@mmimica
Copy link
Contributor

mmimica commented Nov 11, 2022

Driver version

11.2.1

Client Operating System

Linux

Problem description

When the database driver is used to connect to different SQLServer hosts, it can happen that the TCP connection is established to the wrong host. This is due to a race-condition in com.microsoft.sqlserver.jdbc.SocketFinder#getSocketByIPPreference. The change was introduced in #1766.

com.microsoft.sqlserver.jdbc.SocketFinder#addressList is static, and this state is shared across all SQLServerConnection instances, even if connected to different SQLServer hosts. A race-condition when mutating this state in com.microsoft.sqlserver.jdbc.SocketFinder#getSocketByIPPreference can lead to the socked being connected to an unexpected host.

@Jeffery-Wasty
Copy link
Contributor

Hi @mmimica,

Thank you, we'll take a look into both the issue and the potential fix.

@lilgreenbird lilgreenbird added this to the 12.2.0 milestone Dec 14, 2022
@lilgreenbird lilgreenbird added the Bug A bug in the driver. A high priority item that one can expect to be addressed quickly. label Dec 14, 2022
tkyc pushed a commit that referenced this issue 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 issue 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 issue 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 issue 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 issue 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants