Deadlock on Windows Server 2012 when passing same pipe for stdout and stderr

オープン
#76 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

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

調査の方向性

提供された Haskell の再現コードを System.Process を使って開始し、特に stdout と stderr に同じ UseHandle を指定した createProcess を使用します。AppVeyor を通じて ghceye の再現を実行し、Windows Server 2012、Windows 10、Linux での動作を比較します。影響を受ける Windows バージョンで、再現したプロセスがデッドロックせずに終了すれば完了です。

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

説明

The following Haskell program, built with GHC 8.0.1, deadlocks on Windows Server 2012:

import System.Process
import System.IO
import System.Exit
main = do
    hSetBuffering stderr NoBuffering
    hSetBuffering stdout NoBuffering
    (readIn, writeIn) <- createPipe
    (readOut, writeOut) <- createPipe
    (_,_,_,proch) <- createProcess (proc "python" ["-i"]) {
            std_in = UseHandle readIn,
            std_out = UseHandle writeOut,
            std_err = UseHandle writeOut
        }
    hPutStrLn writeIn "print(42)"
    hPutStrLn writeIn "quit()"
    hClose writeIn
    exit <- waitForProcess proch
    hPutStrLn stderr =<< hGetContents readOut
    hClose readOut
    exitWith exit

You can reproduce the error on AppVeyor with the following repository: https://github.com/ezyang/ghceye (appveyor.yml included).

It does not appear to deadlock on Windows 10 or Linux. I have not attempted to reproduce on a local install of Windows Server 2012. I tried this similar Python code which did not deadlock, which is why I believe it to be a bug in the process library:

import subprocess
import os

(rin, win) = os.pipe()
(rout, wout) = os.pipe()
p = subprocess.Popen(["python", "-i"], stdin=rin, stdout=wout, stderr=wout)
os.write(win, "print(2)")
os.write(win, os.linesep)
os.write(win, "quit()")
os.write(win, os.linesep)
p.wait()
主要言語
Haskell
スター
91
フォーク
93
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

haskell/process のほかの issue

haskell/process の issue をすべて見る

似ている issue

Haskell の issue をもっと見る

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

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