Project

General

Profile

Bug #2008

test_io.rb: test 2 fails on FreeBSD

Added by lucas (Lucas Nussbaum) about 8 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
1.9.1.243 GNU/kfreebsd
[ruby-core:25164]

Description

=begin
Hi,

Test 2 in test_io.rb fails on FreeBSD. This is related to http://redmine.ruby-lang.org/issues/show/1066, which, according to the comments posted after the bug was closed, wasn't really fixed.

I ran into this on Debian GNU/kfreebsd (Debian userland, freebsd kernel). One of our freebsd porter wrote (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=543805):

The test assumes that the kernel buffer for pipes have fixed size.
It does not have to be true, there could be adaptive buffer size
provided by kernel. After filling whole kernel buffer (by non-blocking
write), it might be required to buffer becomes filled only from half
or even empty. The next write() might be blocked until whole
kernel buffer is read. Such behaviour of kernel is correct one.

The kernel of FreeBSD uses adaptive pipe sizes and direct pipe writes,
see http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sys_pipe.c

(It is likely to be the same on Mac OS X)

He suggests changing the test to:

begin
require "io/nonblock"
r, w = IO.pipe
w.nonblock = true
bytes = w.write_nonblock("a" * 100000)
w.nonblock = false
t1 = Thread.new { w.write("b" * 4096) }
t2 = Thread.new { w.write("c" * 4096) }
sleep 0.5
blocks = 2 + bytes/4096
blocks.times {
r.sysread(4096).length
sleep 0.1
}
t1.join
t2.join
rescue LoadError
end

However, I don't understand what that test is trying to test. It might be better to simply remove that test...
=end


Related issues

Related to Ruby trunk - Bug #1066: Frequent failure: test_io.rb test 2 on OS X 10.5.6Rejected2009-01-28

History

#1 Updated by naruse (Yui NARUSE) about 8 years ago

  • Status changed from Open to Assigned
  • Assignee set to akr (Akira Tanaka)

=begin

=end

#2 Updated by yugui (Yuki Sonoda) about 8 years ago

  • Category set to core
  • Target version set to 1.9.2

=begin

=end

#3 Updated by naruse (Yui NARUSE) about 8 years ago

  • Status changed from Assigned to Closed

=begin
this seems resolved.
=end

#4 Updated by lucas (Lucas Nussbaum) over 7 years ago

=begin
No, this is still a problem. How can I reopen that bug?
=end

#5 Updated by mame (Yusuke Endoh) over 7 years ago

=begin
What's the revision?

2010/8/1 Lucas Nussbaum redmine@ruby-lang.org:

Issue #2008 has been updated by Lucas Nussbaum.

No, this is still a problem. How can I reopen that bug?

http://redmine.ruby-lang.org/issues/show/2008


http://redmine.ruby-lang.org

--
Yusuke Endoh mame@tsg.ne.jp

=end

#6 Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Status changed from Closed to Feedback

=begin

=end

#7 Updated by mame (Yusuke Endoh) over 7 years ago

  • Priority changed from Normal to 3

=begin
According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=543805,
this seems to be just a problem of test.
I change this to Low priority.
=end

#8 [ruby-core:37416] Updated by nahi (Hiroshi Nakamura) over 6 years ago

  • Target version changed from 1.9.2 to 1.9.3

#9 [ruby-core:37958] Updated by kosaki (Motohiro KOSAKI) over 6 years ago

At least, current trunk + FreeBSD 8.2 don't reproduce this issue.

#10 [ruby-core:37959] Updated by kosaki (Motohiro KOSAKI) over 6 years ago

  • Target version changed from 1.9.3 to 2.0.0

#11 [ruby-core:37963] Updated by naruse (Yui NARUSE) over 6 years ago

  • ruby -v changed from 1.9.1.243 to 1.9.1.243 GNU/kfreebsd

Motohiro KOSAKI wrote:

At least, current trunk + FreeBSD 8.2 don't reproduce this issue.

This issue is about GNU/kfreebsd, not normal FreeBSD.

#12 [ruby-core:52442] Updated by mame (Yusuke Endoh) almost 5 years ago

  • Target version changed from 2.0.0 to next minor

#13 [ruby-core:54047] Updated by akr (Akira Tanaka) over 4 years ago

  • Status changed from Feedback to Closed

Finally I installed Debian GNU/kFreeBSD 6.0.7 (squeeze) and
Debian GNU/kFreeBSD 7.0 (wheezy) and tested test_io.rb.

But I couldn't reproduce the problem.
So I close this issue.

#14 [ruby-core:54052] Updated by akr (Akira Tanaka) over 4 years ago

Oops. I forgot to note what ruby I tested.

% ./ruby -v
ruby 2.1.0dev (2013-04-06 trunk 40143) [x86_64-kfreebsd8.1-gnu]
% lsb_release -idrc
Distributor ID: Debian
Description: Debian GNU 6.0.7 (squeeze)
Release: 6.0.7
Codename: squeeze

% ./ruby -v
ruby 2.1.0dev (2013-04-06 trunk 40143) [x86_64-kfreebsd9.0-gnu]
debian7-kfreebsd(12:20:17)% lsb_release -idrc
Distributor ID: Debian
Description: Debian GNU/kFreeBSD 7.0 (wheezy)
Release: 7.0
Codename: wheezy

Also available in: Atom PDF