Actions
Bug #19364
closedIssue with tracepoint enable/disable across ractors
Bug #19364:
Issue with tracepoint enable/disable across ractors
Description
This sometimes segfaults:
def test_enable_disable_in_multiple_ractors_with_target
rs = []
100.times do |i|
# setup new iseqs
Kernel.define_method :"my_method_to_change_for_tracing_#{i}" do
true
end
end
100.times do |i|
rs << Ractor.new(i) do |j|
meth = :"my_method_to_change_for_tracing_#{j}"
tp = TracePoint.new(:line) { } # local to ractor
100.times do
tp.enable(target: method(meth)) # change iseq internals of given method, should be done with lock
tp.disable # disable hooks should hold lock too, changes method definition internals
end
end
end
rs.each(&:take) # shouldn't raise
end
test_enable_disable_in_multiple_ractors_with_target()
Changing iseq internals is done without the VM lock. This is true in Tracepoint#enable and Tracepoint#disable methods.
I have a patch coming.
Updated by hsbt (Hiroshi SHIBATA) over 3 years ago
- Status changed from Open to Assigned
- Assignee set to ko1 (Koichi Sasada)
Updated by jhawthorn (John Hawthorn) over 1 year ago
- Assignee changed from ko1 (Koichi Sasada) to ractor
Updated by ko1 (Koichi Sasada) 1 day ago
- Status changed from Assigned to Closed
Re-checked on master 4d185cce78 with a RUBY_DEBUG=1 build: the script in the description
runs clean, 30 times out of 30.
The cause you named -- "changing iseq internals is done without the VM lock" -- has been
addressed. rb_tracepoint_enable_for_target() in vm_trace.c now stops the world before
rewriting the iseq:
Actions