Active Perl で binmode STDERR, “:encoding(cp932)”; 後の dieでフリーズ

windows上で、perlのスクリプトを書いているときに、コマンドプロンプトで実行後、die のタイミングで応答が無くなって、CPUを食いまくっててctrl-c も効かず、タスクマネージャでperlのプロセスを落とさざるをえなくなる状況がありました。 その時は、binmode STDERR, “:encoding(cp932)”;をコメントアウトしたら現象が収まったので、それで切り抜けました。

そしたら、@lemorin_jp さんが再現しようとしてくれました。

確認したところ、スペルミスではなかったですが、 反応していただいたからには、俺もちゃんと調べないといけないなと思い、調査しました。

環境

  • OS: Windows Server 2012
  • perl: 5.024001

再現方法

最短の再現方法を突き止めるまで、かなり試行錯誤しましたが、どうやら、パスにある程度の長さの日本語フォルダ名が含まれることが必要だったようです。

1. Cドライブ直下に、「ああああああ」という名前のフォルダを作成する。C:\ああああああ

2. c:\ああああああ に freeze.pl スクリプトを作成する。

binmode STDERR, ":encoding(cp932)";
printf "Perl: %s\n", $];
die;

3. コマンドプロンプトで、スクリプトを実行する。

C:\> perl c:\ああああああ\freeze.pl
Perl: 5.024001

4. コマンドプロンプトで、終了もせず、Ctrl-c も効かず、CPU使用率が上がったままの状態となる。

以下は、スクリプトの配置パスが影響しているようで、複数のパスで再現テストをした結果です。

パス再現
C:\ああああああ\freeze.pl
C:\あああああ\freeze.pl×
C:\Users\Administrator\Documents\あああああ\freeze.pl
C:\Users\Administrator\Documents\かきくけこ\freeze.pl×
C:\Users\Administrator\Documents\aaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaa\freeze.pl
×

なんか、秘孔ついちゃったような動作なので、他の方も再現するようなら公式に報告すべきかもです。 試してもらえたら結果を教えてほしいです。

3件のコメント

  • I have not checked in here for a while because I thought it was getting boring, but the last several posts are good quality so I guess I will add you back to my everyday bloglist. You deserve it my friend :)

  • Broker of record: The individual registered with his or her government licensing office as the managing broker of a certain assets sales company. But if you want to decrease your probability of failure and generate income faster, I’ll choose to be an innovator.

    But these steps are not everything else you cannot do being a home-based business entrepreneur.

  • The Houston storage unit is not only convenient but in addition offers a safe service, so you can also store your credentials and documents without passing it on an extra thought. This is obviously not the perfect case for everybody, so if you may need to rent that storage for any shorter duration, definitely allow the company know to enable them to will give you appropriate plan. The unit must be necessarily totally free of rodents, insects, or another intrusions that might prove to be fatal for your goods.

コメントする

メールアドレスが公開されることはありません。 が付いている欄は必須項目です


The reCAPTCHA verification period has expired. Please reload the page.

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください