Project

General

Profile

Actions

Backport #8065

closed

r39688 - test_queue.rb (test_thr_kill): reduce iterations from 2000 to 250. のバックポート

Added by kosaki (Motohiro KOSAKI) about 11 years ago. Updated about 11 years ago.


Description

現在、uniprocessor環境で test_thr_killを実行すると、ほぼ必ず失敗します。原因はコミットログにも書いたのですが
以下の様なスクリプトがあるとき、

total_count.times do |i|
open("test_thr_kill_count", "w") {|f| f.puts i }
queue = Queue.new
r, w = IO.pipe
th = Thread.start {
queue.push(nil)
r.read 1
}
queue.pop
th.kill
th.join
end

ほぼ確実に、

1、Thread.start
2.Queue.pop
3,ここでコンテキストスイッチ
4,Queue.push
5.r.readの処理の途中で gvl_release()
6.ここでコンテキストスイッチ
7.th.kill -> ubf_select -> pthread_kill(SIGVTALARM) とくるが、
別に、ブロッキングシステムコールで寝ているわけではないので
サブスレッドには影響ない
8.th.join
9.ここでコンテキストスイッチ
10.read(2) を呼ぶ
11.ここで動いているスレッドが一旦いなくなる
12.100msec後にtimer threadがSIGVTALARMを再送、read()が解除される

と動くので、30秒間では300回しかループが回りません。

状況証拠的に [Bug #7521] の原因だと見ています。確証はないので、別チケットにしましたが。


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #7521: test_thr_kill(TestQueue) failsClosedkosaki (Motohiro KOSAKI)12/06/2012Actions
Actions

Also available in: Atom PDF

Like0
Like0