Bug #373
MingwでIO#dupがブロックする
| Status: | Closed | Start date: | ||
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | test | |||
| Target version: | 2.0.0 | |||
| ruby -v: | ruby 1.9.2dev (2009-11-06 trunk 25671) [i386-mingw32] |
Description
ワナベと申します。
ruby-list に送った不具合を改めてこちらにも書かせていただきます。
Mingw 上の trunkで、test/ruby/test_io.rb の test_dup のように
パイプを最大まで作成してから IOオブジェクトの dup を繰り返すと
処理が停止します。
$ ./ruby -ve '
a = []
loop{a.push IO.pipe} rescue nil
loop {a.push(p a[0][0].dup)}'
ruby 1.9.0 (2008-07-24 revision 18196) [i386-mingw32]
#<IO:0xbbdbe0> # ここで処理が止まる
また以下の結果から、msvcrt の問題のように思えます。
$ cat test.c
#include <stdio.h>
#include <io.h>
int main(int argc, char **argv) {
int n = 0;
while(_dup(0) != -1) n++;
printf("n = %i\n", n);
_dup(0);
printf("fin\n");
return 0;
}
$ gcc -mno-cygwin test.c && ./a.exe
n = 2045 // ← CTRL+C で中断するまで処理が止まる
$ gcc -mno-cygwin test.c -lmsvcr71 && ./a.exe
n = 2045
fin
--
ワナベ
Related issues
Associated revisions
* test/ruby/test_io.rb (test_dup_many): extracted from test_dup.
test in ruby subprocess. at asakusa.rb. [ruby-dev:35648]
History
Updated by ko1 (Koichi Sasada) almost 4 years ago
- Assignee set to nobu (Nobuyoshi Nakada)
Updated by yugui (Yuki Sonoda) over 3 years ago
- Target version set to 1.9.1 Release Candidate
Updated by rogerdpack (Roger Pack) over 3 years ago
pardon my english. Seems that there are a few other problems with the msvcrt6 [1]. I wonder if VC6 does not suffer with these problems, and, if not, did they have to do their own workarounds? If so then this is [I suppose] a mingw issue not a ruby one. I know the OCI guys with mingw had problems with descriptors not working, too[2]. Thoughts? -=R [1] http://www.ruby-forum.com/topic/169681#744518 [2] http://markmail.org/message/hlsuk3ukejabfjrg
Updated by usa (Usaku NAKAMURA) over 3 years ago
Hello, In message "[ruby-dev:37022] [Bug #373] MingwでIO#dupがブロックする" on Nov.04,2008 07:30:38, <redmine@ruby-lang.org> wrote: > pardon my english. > Seems that there are a few other problems with the msvcrt6 [1]. > [1] http://www.ruby-forum.com/topic/169681#744518 I can't understand the problems from this URL. How do I reproduce them? > I wonder if VC6 does not suffer with these problems, and, if not, did they have to do their own workarounds? If so then this is [I suppose] a mingw issue not a ruby one. > I know the OCI guys with mingw had problems with descriptors not working, too[2]. > Thoughts? > [2] http://markmail.org/message/hlsuk3ukejabfjrg It's not our problem, but readline's. Regards, -- U.Nakamura <usa@garbagecollect.jp>
Updated by akr (Akira Tanaka) over 3 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset r20630.
Updated by wanabe (_ wanabe) over 2 years ago
- File test_io_noblock.patch added
- Category set to test
- Target version changed from 1.9.1 Release Candidate to 2.0.0
- ruby -v set to ruby 1.9.2dev (2009-11-06 trunk 25671) [i386-mingw32]
古いチケットへの反応ですみません。 この件、対応していただいたおかげで子プロセスを kill すれば テストが進むようになりましたが、できればタイムアウトした方が よいかと思い、今更ながらパッチを書きました。 よろしければご検討ください。
Updated by rogerdpack (Roger Pack) 12 months ago
Was this fixed in r20630 ?