[ruby-dev:49951] [Ruby trunk Bug#12924] Fiddle::TestFunction#test_nogvl_poll fails on macOS 10.12-10.12.1 Sierra

From: shyouhei@...
Date: 2017-01-11 00:54:03 UTC
List: ruby-dev #49951
Issue #12924 has been updated by Shyouhei Urabe.


Yes.  This issue is marked "Third Party's Issue", which means we have nothi=
ng to do.  This state is kind of close.

----------------------------------------
Bug #12924: Fiddle::TestFunction#test_nogvl_poll fails on macOS 10.12-10.12=
.1 Sierra
https://bugs.ruby-lang.org/issues/12924#change-62451

* Author: Wataru Kimura
* Status: Third Party's Issue
* Priority: Normal
* Assignee:=20
* Target version:=20
* ruby -v: ruby 2.4.0dev (2016-11-12 trunk 56725) [x86_64-darwin16]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
macOS 10.12.1=E4=B8=8A=E3=81=A7Fiddle::TestFunction#test_nogvl_poll=E3=81=
=8C=E5=A4=B1=E6=95=97=E3=81=97=E3=81=BE=E3=81=99=E3=80=82OS X 10.11=E3=81=
=A7=E3=81=AF=E5=95=8F=E9=A1=8C=E3=81=82=E3=82=8A=E3=81=BE=E3=81=9B=E3=82=93=
=E3=80=82
2.4-preview3=E3=81=8A=E3=82=88=E3=81=B3trunk(r56725)=E3=81=A7=E7=A2=BA=E8=
=AA=8D=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82

~~~
  1) Failure:=20
Fiddle::TestFunction#test_nogvl_poll [/.../ruby-2.4.0-preview3/test/fiddle/=
test_function.rb:91]:=20
slept correct amount of time.=20
Expected |200 - 0| (200) to be <=3D 100.
~~~=20

=E3=81=8A=E3=81=9D=E3=82=89=E3=81=8Fruby=E5=81=B4=E3=81=AE=E5=95=8F=E9=A1=
=8C=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=8F=E3=80=81poll(2)=E3=81=AE=E5=8B=95=
=E4=BD=9C=E3=81=8C10.12=E3=81=A7=E5=A4=89=E3=82=8F=E3=81=A3=E3=81=9F=E3=82=
=88=E3=81=86=E3=81=A7=E3=81=99=E3=80=82
poll=E3=81=B8=E6=B8=A1=E3=81=97=E3=81=9Fnfds=E3=81=AE=E5=80=A4=E3=81=8C0=E3=
=81=AE=E3=81=A8=E3=81=8D=E3=80=81=E5=BE=85=E3=81=9F=E3=81=9A=E3=81=AB=E3=81=
=99=E3=81=90=E6=8A=9C=E3=81=91=E3=81=A6=E3=81=97=E3=81=BE=E3=81=84=E3=81=BE=
=E3=81=99=E3=80=82
=E5=8F=82=E8=80=83: https://github.com/curl/curl/issues/1057

opensource.apple.com=E3=81=AB=E3=81=AF=E3=81=BE=E3=81=A010.12=E3=81=AE=E3=
=82=BD=E3=83=BC=E3=82=B9=E3=82=B3=E3=83=BC=E3=83=89=E3=81=8C=E4=B8=8A=E3=81=
=8C=E3=81=A3=E3=81=A6=E3=81=84=E3=81=AA=E3=81=84=E3=81=9F=E3=82=81
=E5=AE=9F=E9=9A=9B=E3=81=ABpoll=E3=81=8C=E5=A4=89=E6=9B=B4=E3=81=95=E3=82=
=8C=E3=81=9F=E3=81=8B=E3=81=AF=E7=A2=BA=E8=AA=8D=E3=81=A7=E3=81=8D=E3=81=A6=
=E3=81=84=E3=81=BE=E3=81=9B=E3=82=93=E3=80=82

=E4=BB=A5=E4=B8=8B=E3=81=AE=E3=82=B3=E3=83=BC=E3=83=89=E3=81=A7=E7=A2=BA=E8=
=AA=8D=E3=81=97=E3=81=A6=E3=81=BF=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82

~~~ ruby
require 'fiddle/import'
require 'tempfile'

include Fiddle

libc =3D dlopen('/usr/lib/libc.dylib')
@func =3D Function.new(libc['poll'], [TYPE_VOIDP, TYPE_INT, TYPE_INT], TYPE=
_INT)

def test_poll(fds, nfds)
    t0 =3D Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
    n1 =3D @func.call(fds&.to_ptr, nfds, 200)
    t1 =3D Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
    puts "fd=3D#{fds ? fds.fd : "(nil)"}, nfds=3D#{nfds}, slept=3D#{t1 - t0=
}"
end

fds =3D Fiddle::Importer.struct(["int fd", "short events", "short revents"]=
).malloc
file =3D Tempfile.open('test_poll')
begin
    fds.fd =3D file.fileno
    fds.events =3D 0
    fds.revents =3D 0

    puts RUBY_DESCRIPTION
    puts `uname -sr`.chomp
    test_poll(fds, 0) # not block on macOS Sierra
    test_poll(fds, 1)
    test_poll(nil, 0) # not block on macOS Sierra
    test_poll(nil, 1)
ensure
    file.unlink
end
~~~

=E7=B5=90=E6=9E=9C=E3=81=AF=E6=AC=A1=E3=81=AE=E9=80=9A=E3=82=8A=E3=81=A7=E3=
=81=99=E3=80=82

~~~
# trunk on 10.12 Sierra=20
ruby 2.4.0dev (2016-11-12 trunk 56725) [x86_64-darwin16]
Darwin 16.1.0
fd=3D7, nfds=3D0, slept=3D0       ###
fd=3D7, nfds=3D1, slept=3D201
fd=3D(nil), nfds=3D0, slept=3D0   ###
fd=3D(nil), nfds=3D1, slept=3D0

# 2.4-preview3 on 10.12 Sierra=20
ruby 2.4.0preview3 (2016-11-07 trunk 56661) [x86_64-darwin16]
Darwin 16.1.0
fd=3D7, nfds=3D0, slept=3D0       ###
fd=3D7, nfds=3D1, slept=3D205
fd=3D(nil), nfds=3D0, slept=3D0   ###
fd=3D(nil), nfds=3D1, slept=3D0

# 2.4-preview3 on 10.11 El Capitan=20
ruby 2.4.0preview3 (2016-11-07 trunk 56661) [x86_64-darwin15]
Darwin 15.6.0
fd=3D7, nfds=3D0, slept=3D206     ###
fd=3D7, nfds=3D1, slept=3D206
fd=3D(nil), nfds=3D0, slept=3D206 ###
fd=3D(nil), nfds=3D1, slept=3D0
~~~




--=20
https://bugs.ruby-lang.org/

In This Thread

Prev Next