ruby-changes:41128
From: nobu <ko1@a...>
Date: Sat, 19 Dec 2015 17:17:04 +0900 (JST)
Subject: [ruby-changes:41128] nobu:r53201 (trunk): webrick/utils.rb: get rid of thread leak checker
nobu 2015-12-19 17:16:54 +0900 (Sat, 19 Dec 2015) New Revision: 53201 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53201 Log: webrick/utils.rb: get rid of thread leak checker * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize): use WEBrick::Utils::TimeoutHandler::Thread, which is ignored by LeakChecker#find_threads, instead of ::Thread to get rid of thread leak checker. since this TimeoutHandler is resident during tests because of Singleton, it waits for the next timeout if it has any schedules. in the case of nested timeouts, inner timeout does not cancel outer timeouts and then those schedules still remain. Modified files: trunk/ChangeLog trunk/lib/webrick/utils.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 53200) +++ ChangeLog (revision 53201) @@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Dec 19 17:17:04 2015 Nobuyoshi Nakada <nobu@r...> + + * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize): + use WEBrick::Utils::TimeoutHandler::Thread, which is ignored by + LeakChecker#find_threads, instead of ::Thread to get rid of + thread leak checker. since this TimeoutHandler is resident + during tests because of Singleton, it waits for the next timeout + if it has any schedules. in the case of nested timeouts, inner + timeout does not cancel outer timeouts and then those schedules + still remain. + Sat Dec 19 14:28:01 2015 Jake Worth <jakeworth82@g...> * ext/zlib/zlib.c (Init_zlib): [DOC] Fix double-word typo and Index: lib/webrick/utils.rb =================================================================== --- lib/webrick/utils.rb (revision 53200) +++ lib/webrick/utils.rb (revision 53201) @@ -177,8 +177,9 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/utils.rb#L177 @queue.pop elsif (wakeup -= now) > 0 begin - Timeout.timeout(wakeup) { @queue.pop } - rescue Timeout::Error + (th = Thread.start {@queue.pop}).join(wakeup) + ensure + th&.kill&.join end end @queue.clear -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/