1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-12-19 08:16:54 +00:00
parent 26bc97bda4
commit a5a9d421e7
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,14 @@
Sat Dec 19 17:17:04 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@gmail.com> Sat Dec 19 14:28:01 2015 Jake Worth <jakeworth82@gmail.com>
* ext/zlib/zlib.c (Init_zlib): [DOC] Fix double-word typo and * ext/zlib/zlib.c (Init_zlib): [DOC] Fix double-word typo and

View file

@ -177,8 +177,9 @@ module WEBrick
@queue.pop @queue.pop
elsif (wakeup -= now) > 0 elsif (wakeup -= now) > 0
begin begin
Timeout.timeout(wakeup) { @queue.pop } (th = Thread.start {@queue.pop}).join(wakeup)
rescue Timeout::Error ensure
th&.kill&.join
end end
end end
@queue.clear @queue.clear