Bug #373

MingwでIO#dupがブロックする

Added by _ wanabe over 5 years ago. Updated almost 3 years ago.

[ruby-dev:35648]
Status:Closed
Priority:Low
Assignee:Nobuyoshi Nakada
Category:test
Target version:2.0.0
ruby -v:ruby 1.9.2dev (2009-11-06 trunk 25671) [i386-mingw32] Backport:

Description

=begin
ワナベと申します。
ruby-list に送った不具合を改めてこちらにも書かせていただきます。

Mingw 上の trunkで、test/ruby/testio.rb の testdup のように
パイプを最大まで作成してから 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
#include
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

--
ワナベ
=end

test_io_noblock.patch Magnifier (490 Bytes) _ wanabe, 11/06/2009 07:40 PM

test_io_noblock.patch Magnifier (490 Bytes) _ wanabe, 11/06/2009 07:59 PM


Related issues

Related to ruby-trunk - Bug #1500: test_io runs forever in windows Third Party's Issue 05/21/2009

History

#1 Updated by Koichi Sasada over 5 years ago

  • Assignee set to Nobuyoshi Nakada

=begin

=end

#2 Updated by Yuki Sonoda over 5 years ago

  • Target version set to 1.9.1 Release Candidate

=begin

=end

#3 Updated by Roger Pack over 5 years ago

=begin
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
=end

#4 Updated by Usaku NAKAMURA over 5 years ago

=begin
Hello,

In message " [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

=end

#5 Updated by Akira Tanaka over 5 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r20630.
=end

#6 Updated by _ wanabe over 4 years ago

  • File test_io_noblock.patchMagnifier 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]

=begin
古いチケットへの反応ですみません。
この件、対応していただいたおかげで子プロセスを kill すれば
テストが進むようになりましたが、できればタイムアウトした方が
よいかと思い、今更ながらパッチを書きました。
よろしければご検討ください。
=end

#7 Updated by Roger Pack almost 3 years ago

Was this fixed in r20630 ?

Also available in: Atom PDF