Description
Closing a connection from Object Explorer does not always result in the corresponding SQL sessions being torn down promptly.
Create an OE connection on a new instance of vscode-mssql:
Disconnecting leaves a bunch of stale connections behind:
Going through this a bunch of times can random connections behind:
In Azure Data Studio, this was reported as connections remaining active for up to 30 minutes after the UI connection was closed. The same behavior is worth tracking in vscode-mssql, especially for Azure SQL serverless scenarios where lingering sessions can prevent auto-pause.
Related Azure Data Studio issue:
microsoft/azuredatastudio#25319
Related vscode-mssql issue:
Steps to Reproduce
- Connect to a SQL Server or Azure SQL database in Object Explorer.
- Optionally expand a database node so that Object Explorer and language-service activity is initialized.
- In a second session, run the following query to monitor active sessions:
SELECT
s.session_id,
s.login_name,
s.host_name,
s.program_name,
s.host_process_id,
s.status,
s.login_time,
s.last_request_start_time,
s.last_request_end_time
FROM sys.dm_exec_sessions AS s
WHERE s.is_user_process = 1
AND (
s.program_name LIKE 'vscode-mssql%'
OR s.program_name LIKE 'sqltools%'
)
ORDER BY s.login_time DESC, s.session_id DESC;
- Disconnect the server connection from Object Explorer in VS Code.
- Re-run the monitoring query shortly after disconnecting.
Expected Behavior
Closing the connection from Object Explorer should promptly close the associated sessions created by vscode-mssql, so that no unnecessary active connections remain.
Actual Behavior
After the connection is closed in the UI, one or more SQL sessions can remain active instead of being terminated promptly.
Affected Area
- Object Explorer
- Connection management
- Potentially language service session cleanup
Environment Information
- VS Code Version:
- MSSQL Extension Version:
- Operating System:
- SQL Server / Azure SQL target:
Additional Notes
Confirmation
- I have searched existing issues and couldn't find an exact match
Description
Closing a connection from Object Explorer does not always result in the corresponding SQL sessions being torn down promptly.
Create an OE connection on a new instance of vscode-mssql:
Disconnecting leaves a bunch of stale connections behind:
Going through this a bunch of times can random connections behind:
In Azure Data Studio, this was reported as connections remaining active for up to 30 minutes after the UI connection was closed. The same behavior is worth tracking in vscode-mssql, especially for Azure SQL serverless scenarios where lingering sessions can prevent auto-pause.
Related Azure Data Studio issue:
microsoft/azuredatastudio#25319
Related vscode-mssql issue:
Steps to Reproduce
Expected Behavior
Closing the connection from Object Explorer should promptly close the associated sessions created by vscode-mssql, so that no unnecessary active connections remain.
Actual Behavior
After the connection is closed in the UI, one or more SQL sessions can remain active instead of being terminated promptly.
Affected Area
Environment Information
Additional Notes
Confirmation