* [ruby-core:110053] [Ruby master Bug#19020] Unexpected timeout thread appears in ThreadGroup
@ 2022-09-24 9:17 larskanis (Lars Kanis)
2022-09-25 9:18 ` [ruby-core:110065] " larskanis (Lars Kanis)
2022-09-27 17:00 ` [ruby-core:110109] " Eregon (Benoit Daloze)
0 siblings, 2 replies; 3+ messages in thread
From: larskanis (Lars Kanis) @ 2022-09-24 9:17 UTC (permalink / raw)
To: ruby-core
Issue #19020 has been reported by larskanis (Lars Kanis).
----------------------------------------
Bug #19020: Unexpected timeout thread appears in ThreadGroup
https://bugs.ruby-lang.org/issues/19020
* Author: larskanis (Lars Kanis)
* Status: Open
* 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=>#<ThreadGroup:0x00007f12f120adb8>, :list=>[#<Thread:0x00007f12f120acc8 test-threadgroup.rb:4 run>]}
{:after_sleep=>#<ThreadGroup:0x00007f12f120adb8>, :list=>[#<Thread:0x00007f12f120a1d8@Timeout stdlib thread /home/lars/.rvm/rubies/ruby-head/lib/ruby/3.2.0+2/timeout.rb:101 sleep_forever>]}
```
While older ruby versions don't show any timeout thread:
```ruby
$ ruby test-threadgroup.rb
{:after_add=>#<ThreadGroup:0x0000556315b26b50>, :list=>[#<Thread:0x0000556315b26b28@test-threadgroup.rb:4 run>]}
{:after_sleep=>#<ThreadGroup:0x0000556315b26b50>, :list=>[]}
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:110065] [Ruby master Bug#19020] Unexpected timeout thread appears in ThreadGroup
2022-09-24 9:17 [ruby-core:110053] [Ruby master Bug#19020] Unexpected timeout thread appears in ThreadGroup larskanis (Lars Kanis)
@ 2022-09-25 9:18 ` larskanis (Lars Kanis)
2022-09-27 17:00 ` [ruby-core:110109] " Eregon (Benoit Daloze)
1 sibling, 0 replies; 3+ messages in thread
From: larskanis (Lars Kanis) @ 2022-09-25 9:18 UTC (permalink / raw)
To: ruby-core
Issue #19020 has been updated by larskanis (Lars Kanis).
A fix is here: https://github.com/ruby/timeout/pull/22
----------------------------------------
Bug #19020: Unexpected timeout thread appears in ThreadGroup
https://bugs.ruby-lang.org/issues/19020#change-99316
* Author: larskanis (Lars Kanis)
* Status: Open
* 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=>#<ThreadGroup:0x00007f12f120adb8>, :list=>[#<Thread:0x00007f12f120acc8 test-threadgroup.rb:4 run>]}
{:after_sleep=>#<ThreadGroup:0x00007f12f120adb8>, :list=>[#<Thread:0x00007f12f120a1d8@Timeout stdlib thread /home/lars/.rvm/rubies/ruby-head/lib/ruby/3.2.0+2/timeout.rb:101 sleep_forever>]}
```
While older ruby versions don't show any timeout thread:
```ruby
$ ruby test-threadgroup.rb
{:after_add=>#<ThreadGroup:0x0000556315b26b50>, :list=>[#<Thread:0x0000556315b26b28@test-threadgroup.rb:4 run>]}
{:after_sleep=>#<ThreadGroup:0x0000556315b26b50>, :list=>[]}
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:110109] [Ruby master Bug#19020] Unexpected timeout thread appears in ThreadGroup
2022-09-24 9:17 [ruby-core:110053] [Ruby master Bug#19020] Unexpected timeout thread appears in ThreadGroup larskanis (Lars Kanis)
2022-09-25 9:18 ` [ruby-core:110065] " larskanis (Lars Kanis)
@ 2022-09-27 17:00 ` Eregon (Benoit Daloze)
1 sibling, 0 replies; 3+ messages in thread
From: Eregon (Benoit Daloze) @ 2022-09-27 17:00 UTC (permalink / raw)
To: ruby-core
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=>#<ThreadGroup:0x00007f12f120adb8>, :list=>[#<Thread:0x00007f12f120acc8 test-threadgroup.rb:4 run>]}
{:after_sleep=>#<ThreadGroup:0x00007f12f120adb8>, :list=>[#<Thread:0x00007f12f120a1d8@Timeout stdlib thread /home/lars/.rvm/rubies/ruby-head/lib/ruby/3.2.0+2/timeout.rb:101 sleep_forever>]}
```
While older ruby versions don't show any timeout thread:
```ruby
$ ruby test-threadgroup.rb
{:after_add=>#<ThreadGroup:0x0000556315b26b50>, :list=>[#<Thread:0x0000556315b26b28@test-threadgroup.rb:4 run>]}
{:after_sleep=>#<ThreadGroup:0x0000556315b26b50>, :list=>[]}
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-27 17:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-24 9:17 [ruby-core:110053] [Ruby master Bug#19020] Unexpected timeout thread appears in ThreadGroup larskanis (Lars Kanis)
2022-09-25 9:18 ` [ruby-core:110065] " larskanis (Lars Kanis)
2022-09-27 17:00 ` [ruby-core:110109] " Eregon (Benoit Daloze)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).