[#106355] [Ruby master Bug#18373] RBS build failure: '/include/x86_64-linux/ruby/config.h', needed by 'constants.o'. — "vo.x (Vit Ondruch)" <noreply@...>
Issue #18373 has been reported by vo.x (Vit Ondruch).
28 messages
2021/12/01
[ruby-core:106852] [Ruby master Bug#16889] TracePoint.enable { ... } also activates the TracePoint for other threads, even outside the block
From:
"jeremyevans0 (Jeremy Evans)" <noreply@...>
Date:
2021-12-27 21:57:36 UTC
List:
ruby-core #106852
Issue #16889 has been updated by jeremyevans0 (Jeremy Evans).
I submitted a pull request to make `enable` affect the current thread by default: https://github.com/ruby/ruby/pull/5359
The power_assert bundled gem tests fail with it, so power_assert will need to be updated before this can be merged. Just adding `target_thread: nil` to the `enable` calls does not appear to be enough to make power_assert work.
----------------------------------------
Bug #16889: TracePoint.enable { ... } also activates the TracePoint for other threads, even outside the block
https://bugs.ruby-lang.org/issues/16889#change-95663
* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
```ruby
threads = []
inspects = []
trace = TracePoint.new(:line) do |tp|
threads << Thread.current
inspects << tp.inspect
end
done = false
thread = Thread.new do
Thread.pass until done
end
trace.enable do
line_event = true
done = true
sleep 1
end
thread.join
# Expected only within enable block (lines 14-16)
puts inspects
# Expected just 1
p threads.uniq
```
Results in:
```
$ ruby tpbug.rb
ruby tpbug.rb
#<TracePoint:line@tpbug.rb:14>
#<TracePoint:line@tpbug.rb:15>
#<TracePoint:line@tpbug.rb:16>
#<TracePoint:line@tpbug.rb:10>
[#<Thread:0x00005571134e3340 run>, #<Thread:0x00005571138ac828@tpbug.rb:9 dead>]
```
But I expected:
```
#<TracePoint:line@tpbug.rb:14>
#<TracePoint:line@tpbug.rb:15>
#<TracePoint:line@tpbug.rb:16>
[#<Thread:0x00005571134e3340 run>]
```
Because the RDoc says:
```
If a block is given, the trace will only be enabled within the scope of
the block.
```
For background I'm trying to improve the TracePoint specs in ruby/spec, but they are proving quite unreliable due to this.
@ko1 Thoughts?
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>