Windows process terminates once the originating WSL terminal closes

オープン
#42,296 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp, linux, ubuntu

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
C++
スター
34.4k
フォーク
1.9k
平均マージ
1日 23時間
マージ済み PR(30日)
166

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/WSL のほかの issue

microsoft/WSL の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。