kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: kgio@librelist.org
Subject: Re: kgio test_signal_close failed
Date: Mon, 5 Mar 2012 14:30:15 -0800	[thread overview]
Message-ID: <20120305223015.GA15306@dcvr.yhbt.net> (raw)
In-Reply-To: CAAB-Kcn9cUY7GMR9m41JDU+3b4QZUwLqPs5xTP1N7CpDJU+xqQ@mail.gmail.com

375gnu <375gnu@gmail.com> wrote:
> On 3/4/12, Eric Wong <normalperson@yhbt.net> wrote:
> > 375gnu <375gnu@gmail.com> wrote:
> >> Sometimes test_signal_close from test_poll.rb fails. Not every time, and
> >> only
> >> with ruby1.9 (1.9.3.0 is my current version). With ruby 1.8.7 it's passed.
> > Is this also on Debian/kfreebsd?
> 
> Not (0 of 25 times). But it runs in kvm, so it's much slower than real linux
> box (110 sec for all tests vs. 75).

Odd, I can't reproduce under kvm (Debian wheezy + custom 3.3.0-rc4
kernel).  Are you on 2.6.38 kernel by any chance?  Some versions of that
had weird signal issues.

Also, this test is just skipped under Matz Ruby 1.8 (can't safely
support poll() w/o native threads + GVL release).

> >>     59:     thr = Thread.new { sleep 0.100; Process.kill(:USR1, $$) }
> >
> > Does increasing the sleep time there help?  It's a potential race
> > condition :/
> 
> No, even with "sleep 2" (1 of 10 is failed)

Perhaps this makes the test less bad?

diff --git a/test/test_poll.rb b/test/test_poll.rb
index ba0e561..df59354 100644
--- a/test/test_poll.rb
+++ b/test/test_poll.rb
@@ -58,7 +58,10 @@ class TestPoll < Test::Unit::TestCase
     res = nil
     thr = Thread.new { sleep 0.100; Process.kill(:USR1, $$) }
     t0 = Time.now
-    assert_raises(IOError) { Kgio.poll({@rd => Kgio::POLLIN}) }
+    assert_raises(IOError) do
+      result = Kgio.poll({@rd => Kgio::POLLIN})
+      result.each_key { |io| io.read_nonblock(1) }
+    end
     diff = Time.now - t0
     thr.join
     assert diff >= 0.010, "diff=#{diff}"


  reply	other threads:[~2012-03-05 22:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-04 16:12 kgio test_signal_close failed 375gnu
2012-03-04 19:17 ` Eric Wong
2012-03-05 18:56   ` 375gnu
2012-03-05 22:30     ` Eric Wong [this message]
2012-03-06 16:34       ` 375gnu
2012-03-07  9:17         ` Eric Wong
2012-03-07  9:51           ` Iñaki Baz Castillo
2012-03-07 10:16             ` Eric Wong
2012-03-07 10:23               ` Iñaki Baz Castillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/kgio/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120305223015.GA15306@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=kgio@librelist.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/kgio.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).