Windows process terminates once the originating WSL terminal closes

Open
#42,296 5 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp, linux, ubuntu

Research direction

Start by reading the reproduction steps and the related issue #11258; the payload does not identify source files or tests. Investigate how WSL handles Windows processes launched through $WSL_INTEROP when the originating terminal closes, then verify whether a process launched from a surviving tmux session remains alive after that terminal closes.

Written by the indexing model from the issue text.

Description

emailed-logs feature wsl2
Windows Version

Microsoft Windows [Version 10.0.26200.9974]

WSL Version

2.7.13.0

Are you using WSL 1, WSL 2, or WSLC?
  • WSL 2
  • WSL 1
  • WSLC
Kernel Version

6.18.33.2-2

Distro Version

Ubuntu 24.04

Other Software
> tmux -V
tmux 3.5
Repro Steps
  1. Start a Windows Terminal. Open an Ubuntu profile tab. Now:
> echo "$WSL_INTEROP"
/run/WSL/1297782_interop
  1. Start a Linux process (e.g. tmux here) that stays alive after the Windows Terminal closes.
> tmux -L interop-test -f /dev/null new-session

Inside tmux:

> echo "$WSL_INTEROP"
/run/WSL/1297782_interop
> ps -p 1297782 -o pid,ppid,lstart,comm,args
    PID    PPID                  STARTED COMMAND         COMMAND
1297782 1297781 Tue Nov 17 16:36:49 2026 Relay(1297784)  /init
  1. Start a Windows process that is supposed to live long.
> powershell.exe -NoLogo -NoProfile
PS > $PID
1996
PS > Start-Sleep -Seconds 3600
  1. Start another Windows Terminal. Open a PowerShell tab. This is for monitoring. Run:
PS > cat .\test-script.ps1
$targetPid = 1996
$p = Get-Process -Id $targetPid -ErrorAction Stop
"Monitoring PID $($p.Id) ($($p.ProcessName))"
$p.WaitForExit()
"Process exited at $(Get-Date -Format o)"
"Exit code: $($p.ExitCode)"

PS > .\test-script.ps1
Monitoring PID 1996 (powershell)
  1. Close the Windows Terminal window with Ubuntu tab. In the PowerShell window, two more lines are printed:
Monitoring PID 1996 (powershell)
Process exited at 2026-11-17T16:41:32.2517195+09:00
Exit code:
  1. Start yet another Windows Terminal. Open an Ubuntu profile tab. Now:
> echo "$WSL_INTEROP"
/run/WSL/1328701_interop
> tmux -L interop-test -f /dev/null attach

Inside tmux, the powershell.exe process has stopped:

> powershell.exe -NoLogo -NoProfile
PS > $PID
1996
PS > Start-Sleep -Seconds 3600

> echo $?
1
> echo "$WSL_INTEROP"
/run/WSL/1297782_interop
> ps -p 1297782 -o pid,ppid,lstart,comm,args
    PID    PPID                  STARTED COMMAND         COMMAND
> echo $?
1
Expected Behavior

The Windows process should remain running until it terminates normally or is explicitly stopped, even after the originating Windows Terminal is closed, provided that the tmux session remains alive.

Actual Behavior

Closing the originating Windows Terminal causes the Windows process to terminate immediately, as confirmed by an independent Windows PowerShell process monitoring its PID. The tmux session remains alive.
This appears related to #11258, which was automatically closed due to inactivity.

(Side note: Once the $WSL_INTEROP process is gone, we can still launch another Windows process from inside tmux. This process never stops by closing the window as long as the tmux session is alive.)

Diagnostic Logs

No response

Dominant language
C++
Stars
34.4k
Forks
1.9k
Avg merge
1d 23h
Merged PRs (30d)
166

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/WSL

All issues in microsoft/WSL

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.