Repository navigation
Terminate Copilot language server process tree on shutdown - #505
Dietrich Travkin (travkin79) wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Preference-monitor contention can still block shutdown indefinitely, and processes spawned during the grace period can escape cleanup.
2 open issues
What changed in this PR
This PR addresses the shutdown symptoms associated with #408 by limiting preference-path waits and adding process-tree cleanup for an unresponsive Copilot language server.
Changes:
- Adds a two-second shutdown timeout for preference-path requests.
- Waits up to six seconds for server exit, then forcibly terminates the server and captured descendants.
- Blocks server startup while the core bundle is stopping and adds regression tests.
| File | Description |
|---|---|
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/UserPreferenceService.java |
Applies the preference timeout during disposal. |
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ChatBaseService.java |
Adds timeout-aware preference-path retrieval. |
com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/chat/services/UserPreferenceServiceTest.java |
Tests disposal with an unanswered persistence request. |
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/LsStreamConnectionProvider.java |
Prevents server startup during core shutdown. |
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageServerConnection.java |
Adds bounded exit waiting and forced process cleanup. |
com.microsoft.copilot.eclipse.core.test/src/com/microsoft/copilot/eclipse/core/lsp/LsStreamConnectionProviderTests.java |
Tests the shutdown startup guard. |
com.microsoft.copilot.eclipse.core.test/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageServerProcessTests.java |
Tests termination of an unresponsive server and its child. |
Review effort: Balanced
510b73c to
9fa39dc
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Shutdown can still block indefinitely on monitor acquisition despite a successful path timeout; the deadline must cover locking or safely skip saving while loading, with a regression test using independently completed persistence futures.
1 open issue
2 resolved since last review
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
9fa39dc to
6630e79
Compare
|
Hi Sheng Chen (@jdneo), |
|
Hi Sheng Chen (@jdneo), |

Related to #408
While the CLS is busy, closing Eclipse hangs invisibly (window closed, JVM still running):
UserPreferenceService.dispose()waits without limit forconversation/persistence. On RHEL this request wasanswered after 11 min 41 s; only then were
shutdown/exitsent. A busy CLS also does not react toshutdown/exit, so it can outlive Eclipse, keep using 100 % CPU and accumulate across restarts. Duringshutdown, late requests could even start a new CLS.
Changes
waiting for the CLS. On timeout, only the chat input history of the session may not be saved; other preferences
are saved when they change.
descendant processes (e.g. MCP servers), including those started during the wait.
Overlaps with #455 (bounded shutdown flush), but can be merged on its own.
Verification
Verified on RHEL 9.6 with ~400 projects: closing Eclipse while the CLS was busy previously took ~12 minutes
(until the CLS went idle). With this PR, Eclipse exits after ~8 s and the CLS process is gone: