fix(lsp): cleanup subprocess on failed initialization in StdioTransport.start() #11163

Closed
HAL9000 wants to merge 2 commits from fix/pr-11011-subprocess-cleanup into master

2 Commits

Author SHA1 Message Date
HAL9000 c3e89fc341 fix(lsp): restore explicit _process cleanup in OSError handler
CI / helm (pull_request) Successful in 47s
CI / push-validation (pull_request) Successful in 38s
CI / build (pull_request) Successful in 1m12s
CI / quality (pull_request) Successful in 1m25s
CI / lint (pull_request) Failing after 1m26s
CI / typecheck (pull_request) Successful in 1m39s
CI / security (pull_request) Successful in 2m2s
CI / integration_tests (pull_request) Successful in 4m43s
CI / unit_tests (pull_request) Failing after 6m18s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
PR branch HEAD was using try-except-pass around stop() without an
explicit self._process = None assignment in the OSError exception
handler.  This corrected it to match master and the FileNotFoundError
pattern: direct stop() followed by explicit _process = None.

Closes #10597
2026-05-15 14:10:51 +00:00
HAL9000 71ec58b232 fix(lsp): cleanup subprocess on failed initialization in StdioTransport.start()
When Popen() succeeds but then raises OSError (e.g., exec failure in forked
child), the process reference isn't cleaned up, potentially leaking zombie/orphan
language-server processes.

Fix sets _process = None before Popen() call and calls stop() on any partially-
started process in the OSError handler to prevent leaks. Added BDD + pytest
test coverage for regression guard.

Closes #10597
2026-05-15 14:10:51 +00:00