Skip to content

Destroy the terminal process off the UI thread - #2997

Open
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:terminal-destroy-process-async
Open

vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:terminal-destroy-process-async

Conversation

@vogella

@vogella vogella commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Closing a terminal tab, or the workbench with terminals open, froze the UI because ProcessConnector called the CDT Spawner's destroy() on the UI thread. That method sends SIGTERM and waits up to a second before sending SIGKILL, and an interactive shell ignores SIGTERM, so every open terminal added a full second of freeze on shutdown. The process is now destroyed in a background thread, keeping the existing platform-specific order relative to closing the streams. Closing the streams still hangs up the PTY, so the shell exits promptly even when the JVM is shutting down.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Pending destruction can be abandoned during JVM shutdown, and cross-platform process cleanup needs verification.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Moves terminal process destruction off the calling thread to reduce UI freezes when closing tabs or the workbench.

Changes:

  • Adds a daemon-thread helper for process destruction.
  • Schedules destruction before stream cleanup on non-Windows platforms and afterward on Windows.
File Description
terminal/​bundles/​org.eclipse.terminal.connector.process/​src/​org/​eclipse/​terminal/​connector/​process/​ProcessConnector.java Moves process destruction into a background thread.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

private static void destroyInBackground(Process process) {
// Spawner.destroy() waits up to a second for a shell that ignores SIGTERM
Thread thread = new Thread(process::destroy, "Terminal Process Destroy Thread"); //$NON-NLS-1$
thread.setDaemon(true);
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ±0      54 suites  ±0   57m 51s ⏱️ +46s
 4 850 tests ±0   4 828 ✅ ±0   22 💤 ±0  0 ❌ ±0 
12 441 runs  ±0  12 287 ✅ ±0  154 💤 ±0  0 ❌ ±0 

Results for commit 541d90b. ± Comparison against base commit 71639a4.

♻️ This comment has been updated with latest results.

Spawner.destroy() sends SIGTERM and then waits up to a second before
killing the process. An interactive shell ignores SIGTERM, so closing a
terminal tab blocked the UI thread for a full second, and closing the
workbench with several terminals open froze it for that long per tab.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella
vogella force-pushed the terminal-destroy-process-async branch from 377e835 to 541d90b Compare October 8, 2026 12:14
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.

2 participants