Skip to content

Object Explorer session connection mapping accounts for default connection values#520

Merged
mmcfarland merged 1 commit intomainfrom
user/mjm/connection-compare-2
Mar 3, 2025
Merged

Object Explorer session connection mapping accounts for default connection values#520
mmcfarland merged 1 commit intomainfrom
user/mjm/connection-compare-2

Conversation

@mmcfarland
Copy link
Copy Markdown
Member

@mmcfarland mmcfarland commented Mar 3, 2025

A recent change to the client behavior meant that the object explorer would send a standardized ownerUri based on connection details. Previously, the inconsistency meant that the map of connections tracked by the tools service connection manager actually had two different connections stored for the same object explorer session.

Now that a single URI was used, the tools service should have been able to just use the single connection. However, the existing implementation caused a bug and consistent race condition. When the connection manager got the request the for second connection request, it would now correctly see that it already had a connection for these details (via the URI). It then checked to see if the connection details had changed. In the cases where client-optional values weren't set (like port, dbname), the details comparison would fails since those values were added to the details when the actual server connection was opened. The service incorrectly believed that connection details had changed, so it closed the connection to re-create it later.

Meanwhile, the client has likely requested another operation involving the connection, which was possibly closed from above, resulting in a failure. By extending the equality check to account for default values, the tools service should no longer close connections when the details haven't actually changed.

A recent change to the client behavior meant that the object explorer
would send a standard ownerUri based on connection details. Previously,
the inconsistency meant that the map of connections tracked by the
connection manager actually had two different connections stored.

Now that a single URI was used, the tools service should have been able
to just use the single connection. However, the implementation caused a
bug and consistent race condition. When the connection manager got the
request the for second connection request, it would now correctly see
that it already had a connection for these details (via the URI). It
then checked to see if the connection details had changed. Because the
incoming details didn't have the default values (like port, dbname)
applied to it, but did have them on the details stored from the
connection that was actually opened, it incorrectly believed it to be a
"new" connection for the same server. It then closed the connection to
re-create it later.

Meanwhile, the client has likely requested nother operation involving
the connection, which was possibly closed, resulting in a failure. By
extending the equality check to account for default values, the tools
service should no longer close connections when the details haven't
actually changed.
@mmcfarland mmcfarland requested review from a team as code owners March 3, 2025 18:33
@p-singh-ms
Copy link
Copy Markdown
Contributor

p-singh-ms commented Mar 3, 2025

A much more robust match check :)

@mmcfarland mmcfarland merged commit 9043a7a into main Mar 3, 2025
@mmcfarland mmcfarland deleted the user/mjm/connection-compare-2 branch March 3, 2025 19:52
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.

3 participants