Windows process terminates once the originating WSL terminal closes

Abierto
#42,296 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
cpp, linux, ubuntu

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
C++
Estrellas
34.4k
Forks
1.9k
Merge medio
1 d 23 h
PR fusionados (30 d)
166

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/WSL

Todos los issues de microsoft/WSL

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.