Title: VS Code disconnects (DBTS-05102) after ALTER SYSTEM KILL SESSION returns ORA-00031; spool/log file left locked (open handle) until window reload · Issue #34 · oracle/sql-developer-vscode · GitHub
Open Graph Title: VS Code disconnects (DBTS-05102) after ALTER SYSTEM KILL SESSION returns ORA-00031; spool/log file left locked (open handle) until window reload · Issue #34 · oracle/sql-developer-vscode
X Title: VS Code disconnects (DBTS-05102) after ALTER SYSTEM KILL SESSION returns ORA-00031; spool/log file left locked (open handle) until window reload · Issue #34 · oracle/sql-developer-vscode
Description: Summary Running a .sql script from a SQL Worksheet that spools output to a local .log file and issues ALTER SYSTEM KILL SESSION ... IMMEDIATE against a session that cannot be killed synchronously (Oracle returns ORA-00031: session marked...
Open Graph Description: Summary Running a .sql script from a SQL Worksheet that spools output to a local .log file and issues ALTER SYSTEM KILL SESSION ... IMMEDIATE against a session that cannot be killed synchronously (...
X Description: Summary Running a .sql script from a SQL Worksheet that spools output to a local .log file and issues ALTER SYSTEM KILL SESSION ... IMMEDIATE against a session that cannot be killed synchronously (...
Opengraph URL: https://github.com/oracle/sql-developer-vscode/issues/34
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"VS Code disconnects (DBTS-05102) after ALTER SYSTEM KILL SESSION returns ORA-00031; spool/log file left locked (open handle) until window reload","articleBody":"Summary\n\nRunning a .sql script from a SQL Worksheet that spools output to a local .log file and issues ALTER SYSTEM KILL SESSION ... IMMEDIATE against a session that cannot be killed synchronously (Oracle returns ORA-00031: session marked for kill) causes the worksheet's own connection to drop immediately afterwards with DBTS-05102: The connection session was terminated — even though the killed session is a different database session. Because the script never reaches its spool off statement, the local .log file is left with an open OS-level file handle and cannot be opened, renamed, or deleted afterwards (\"used by another process\") until the VS Code window is reloaded.\n\nEnvironment\n\n- Extension: Oracle SQL Developer for VS Code 26.2.1\n- VS Code: 1.135.0 (commit 08d4889f9ec4a1685d257b9b95de036c8e1ce1e5), x64\n- OS: Windows 11 Enterprise 10.0.26200\n- Oracle Database: 19.21.0.0.0 (19c), CDB/PDB architecture\n- Connection type: saved connection profile (Basic/TNS)\n- Instance state at the time: under sustained latch: shared pool contention caused by an unrelated application defect (hundreds of millions of hard-parse/execute cycles of the same shared cursor)\n\nWhat happens\n\n1. A .sql script is run in a SQL Worksheet. It does, in order:\n - spool \"\u003cpath>.log\"\n - a diagnostic SELECT ... FROM gv$session\n - ALTER SYSTEM KILL SESSION '\u003csid>,\u003cserial#>,@\u003cinst>' IMMEDIATE targeting a session that is 100% CPU-bound in a tight server-side PL/SQL loop (no round-trips to its client, so the kill cannot complete synchronously)\n - a follow-up verification SELECT\n - spool off\n2. Oracle correctly returns ORA-00031: session marked for kill for the ALTER SYSTEM KILL SESSION statement — expected, since the target session isn't at an interruptible point yet.\n3. Immediately after that, the worksheet's own connection drops: DBTS-05102: The connection session was terminated. Script execution stops right there.\n4. The remaining statements (verification SELECT and spool off) never run, because the connection is gone.\n\nConsequence: locked spool/log file\n\nBecause spool off never executes, the .log file is left with an open handle. Any subsequent attempt to open/rename/delete it fails with a Windows sharing-violation error. None of the externally-visible processes (sql.exe, java.exe helper processes) appear to hold the handle, which suggests it's held internally by an extension host process rather than an external SQLcl/Java child process.\n\nThis looks like the same underlying class of bug already reported in #29 (extension backend not releasing a Windows file handle around an abrupt state transition) — there it was credentials.sso during a connection-save rename; here it's the spool .log during an abrupt disconnect.\n\nHow to reproduce\n\n1. Have an Oracle session on the target instance that is 100% CPU-bound in a tight, non-interruptible server-side loop (any PL/SQL block that loops without returning control to its client) — the precondition for ALTER SYSTEM KILL SESSION to be unable to complete synchronously.\n2. In a VS Code SQL Worksheet (via this extension), run a script that spools to a file, then issues ALTER SYSTEM KILL SESSION '\u003csid>,\u003cserial#>,@\u003cinst>' IMMEDIATE against that session, followed by more statements and spool off.\n3. Observe ORA-00031, then DBTS-05102 and the worksheet disconnecting before the rest of the script (including spool off) runs.\n4. Try to open/rename/delete the .log file — it's locked.\n\nWorkaround found\n\n- Developer: Reload Window (Ctrl+Shift+P) restarts the extension host and releases the file handle, without needing to fully close and relaunch VS Code.\n- Verifying independently (fresh connection) that the target session's SID/SERIAL# no longer exists in gv$session confirms the KILL SESSION did succeed on the database side despite the client-side disconnect — the disconnect and the locked file appear to be purely client-side artifacts, unrelated to the actual outcome in the database.\n- As a practical mitigation, spooling each script run to a uniquely-named/timestamped log file avoids being blocked by a previously locked file on retry.\n\nSuspected contributing factor\n\nThe instance was under heavy latch: shared pool contention at the time (unrelated application defect). That's an instance-wide shared resource, so it's plausible the worksheet's own session experienced elevated latency at the same moment, compounding with the connection-drop behavior already reported in #25 to trigger the disconnect right after the KILL command.\n\nRelated issues\n\n- #25 — Connection lost after idle period\n- #29 — Windows file handle not released before rename (same class of bug, different file)\n\n---","author":{"url":"https://github.com/flaviogcmelo","@type":"Person","name":"flaviogcmelo"},"datePublished":"2026-08-27T18:04:47Z","url":"https://github.com/oracle/sql-developer-vscode/issues/34"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:44a257f5-bb8c-61a7-5d11-99a6fe427080 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA02:346CFE:260EDF2:31E7200:6B042700 |
| html-safe-nonce | 950486240d710fe7211437cc7b1619d5fbb379daf4069bb2d8ecc23f7af22aa1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTAyOjM0NkNGRToyNjBFREYyOjMxRTcyMDA6NkIwNDI3MDAiLCJ2aXNpdG9yX2lkIjoiNTc5NTY0OTY2NDYwODg0NDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1b463e964d5e7d56e0558b8b6feb5f60914ecb706b7f0c7f61656fd00155220a |
| hovercard-subject-tag | issue:5270653415 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/oracle/sql-developer-vscode/34/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4331145eb73e9e76f3c5b0fda434b1343fa9d7835005c13faa877755673d9934/oracle/sql-developer-vscode/issues/34 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4331145eb73e9e76f3c5b0fda434b1343fa9d7835005c13faa877755673d9934/oracle/sql-developer-vscode/issues/34 |
| og:image:alt | Summary Running a .sql script from a SQL Worksheet that spools output to a local .log file and issues ALTER SYSTEM KILL SESSION ... IMMEDIATE against a session that cannot be killed synchronously (... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | flaviogcmelo |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/oracle/sql-developer-vscode git https://github.com/oracle/sql-developer-vscode.git |
| octolytics-dimension-user_id | 4430336 |
| octolytics-dimension-user_login | oracle |
| octolytics-dimension-repository_id | 996875857 |
| octolytics-dimension-repository_nwo | oracle/sql-developer-vscode |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 996875857 |
| octolytics-dimension-repository_network_root_nwo | oracle/sql-developer-vscode |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width