[前][次][番号順一覧][スレッド一覧]

ruby-changes:52179

From: normal <ko1@a...>
Date: Thu, 16 Aug 2018 12:37:20 +0900 (JST)
Subject: [ruby-changes:52179] normal:r64387 (trunk): test/net/imap/test_imap.rb (test_exception_during_idle): kill infinite looper

normal	2018-08-16 12:37:14 +0900 (Thu, 16 Aug 2018)

  New Revision: 64387

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64387

  Log:
    test/net/imap/test_imap.rb (test_exception_during_idle): kill infinite looper
    
    It is possible for Mutex#sleep (via ConditionVariable#wait)
    to prematurely wake up under MJIT (because Mutex#sleep can't
    handle spurious wakeups).  This affects @idle_done_cond in
    Net::IMAP#idle and means the response handler may never
    set `in_idle' to `true`.
    
    In any case, ensure the infinite looping `raiser' thread
    stops running when the test is done.
    
    Will work on reducing the effect of spurious wakeups from
    MJIT...

  Modified files:
    trunk/test/net/imap/test_imap.rb
Index: test/net/imap/test_imap.rb
===================================================================
--- test/net/imap/test_imap.rb	(revision 64386)
+++ test/net/imap/test_imap.rb	(revision 64387)
@@ -231,7 +231,7 @@ class IMAPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/imap/test_imap.rb#L231
         in_idle = false
         exception_raised = false
         c = m.new_cond
-        @threads << Thread.start do
+        raiser = Thread.start do
           m.synchronize do
             until in_idle
               c.wait(0.1)
@@ -243,6 +243,7 @@ class IMAPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/imap/test_imap.rb#L243
             c.signal
           end
         end
+        @threads << raiser
         imap.idle do |res|
           m.synchronize do
             in_idle = true
@@ -260,6 +261,7 @@ class IMAPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/imap/test_imap.rb#L261
       imap.logout
     ensure
       imap.disconnect if imap
+      raiser.kill unless in_idle
     end
   end
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]