Project

General

Profile

Actions

Bug #6382

closed

test_tracing_with_set_trace_func で RuntimeError "continuation called across threads"

Added by nagachika (Tomoyuki Chikanaga) almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.0.0dev (2012-04-30 trunk 35497) [x86_64-darwin10.8.0]
Backport:
[ruby-dev:45596]

Description

make test-all を -j2 オプションつきで実行しているとごく稀に
test_tracing_with_set_trace_func で "continuation called across threads" という RuntimeError 例外が発生していました。

set_trace_func に設定した lambda から Continuation を呼んでいて、別 Thread がそれを呼んでしまっていたようです。
このテストは r32597 で [Feature #4347] のために追加されたもので、別 Thread からの呼び出しについては元々特に考慮していないようでしたので、呼び出したスレッドをチェックするような変更をすればいいと思います。

diff --git a/test/ruby/test_continuation.rb b/test/ruby/test_continuation.rb
index 64390d8..5e5b78c 100644
--- a/test/ruby/test_continuation.rb
+++ b/test/ruby/test_continuation.rb
@@ -78,10 +78,13 @@ class TestContinuation < Test::Unit::TestCase
end

def tracing_with_set_trace_func

  • orig_thread = Thread.current
    cont = nil
    func = lambda do |*args|
  •  @memo += 1
    
  •  cont.call(nil)
    
  •  if orig_thread == Thread.current
    
  •    @memo += 1
    
  •    cont.call(nil)
    
  •  end
    
    end
    cont = callcc { |cc| cc }
    if cont

稀にというか実際には一度しか発生していないので効果は確認できていないのですが、
エラーにはなってないので入れてしまいます。

Actions #1

Updated by nagachika (Tomoyuki Chikanaga) almost 12 years ago

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

This issue was solved with changeset r35498.
Tomoyuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • test/ruby/test_continuation.rb (tracing_with_set_trace_func): don't
    call Continuation from other threads. [ruby-dev:45596] [Bug #6382]
Actions

Also available in: Atom PDF

Like0
Like0