From: "Eregon (Benoit Daloze)" Date: 2022-09-27T17:00:04+00:00 Subject: [ruby-core:110109] [Ruby master Bug#19020] Unexpected timeout thread appears in ThreadGroup Issue #19020 has been updated by Eregon (Benoit Daloze). Status changed from Open to Closed Fixed in https://github.com/ruby/timeout/pull/22 ---------------------------------------- Bug #19020: Unexpected timeout thread appears in ThreadGroup https://bugs.ruby-lang.org/issues/19020#change-99367 * Author: larskanis (Lars Kanis) * Status: Closed * Priority: Normal * ruby -v: ruby 3.2.0dev (2022-09-23T20:17:54Z master 912ea8257a) [x86_64-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- The new timeout implementation creates a thread at the very first use. This has the side effect, that this management thread appears in a surrounding `ThreadGroup`. See this example: ```ruby require "timeout" threadgroup = ThreadGroup.new thr = Thread.new do Timeout.timeout(10){} end threadgroup.add(thr) p after_add: threadgroup, list: threadgroup.list sleep 0.2 p after_sleep: threadgroup, list: threadgroup.list ``` On ruby master branch the ThreadGroup lists this common management thread of the timeout library: ```ruby $ ruby test-threadgroup.rb {:after_add=>#, :list=>[#]} {:after_sleep=>#, :list=>[#]} ``` While older ruby versions don't show any timeout thread: ```ruby $ ruby test-threadgroup.rb {:after_add=>#, :list=>[#]} {:after_sleep=>#, :list=>[]} ``` -- https://bugs.ruby-lang.org/ Unsubscribe: