[ruby-core:112091] [Ruby master Bug#19387] Issue with ObjectSpace.each_objects not returning IO objects after starting a ractor
Issue #19387 has been reported by luke-gru (Luke Gruber). ---------------------------------------- Bug #19387: Issue with ObjectSpace.each_objects not returning IO objects after starting a ractor https://bugs.ruby-lang.org/issues/19387 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do receive # block, the problem is not the termination of the ractor but the starting end ObjectSpace.each_object(IO) { |io| p io # we get no objects } ``` -- https://bugs.ruby-lang.org/
Issue #19387 has been updated by luke-gru (Luke Gruber). Subject changed from Issue with ObjectSpace.each_objects not returning IO objects after starting a ractor to Issue with ObjectSpace.each_objects not returning objects after starting a ractor The problem is actually for any objects, not just IO. ---------------------------------------- Bug #19387: Issue with ObjectSpace.each_objects not returning objects after starting a ractor https://bugs.ruby-lang.org/issues/19387#change-101525 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do receive # block, the problem is not the termination of the ractor but the starting end ObjectSpace.each_object(IO) { |io| p io # we get no objects } ``` -- https://bugs.ruby-lang.org/
Issue #19387 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Open to Assigned Assignee set to ko1 (Koichi Sasada) ---------------------------------------- Bug #19387: Issue with ObjectSpace.each_objects not returning objects after starting a ractor https://bugs.ruby-lang.org/issues/19387#change-101680 * Author: luke-gru (Luke Gruber) * Status: Assigned * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do receive # block, the problem is not the termination of the ractor but the starting end ObjectSpace.each_object(IO) { |io| p io # we get no objects } ``` -- https://bugs.ruby-lang.org/
Issue #19387 has been updated by ko1 (Koichi Sasada). Status changed from Closed to Assigned c08fdc68383ee368c18e15e298502e6ee0089e18 is not related to this ticket. ---------------------------------------- Bug #19387: Issue with ObjectSpace.each_objects not returning objects after starting a ractor https://bugs.ruby-lang.org/issues/19387#change-104467 * Author: luke-gru (Luke Gruber) * Status: Assigned * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do receive # block, the problem is not the termination of the ractor but the starting end ObjectSpace.each_object(IO) { |io| p io # we get no objects } ``` -- https://bugs.ruby-lang.org/
Issue #19387 has been updated by luke-gru (Luke Gruber). ruby -v set to 3.3.0 I believe this was closed prematurely due to an unrelated git commit that wrongly tagged it. Please reopen :) ---------------------------------------- Bug #19387: Issue with ObjectSpace.each_objects not returning objects after starting a ractor https://bugs.ruby-lang.org/issues/19387#change-106007 * Author: luke-gru (Luke Gruber) * Status: Closed * Priority: Normal * Assignee: ko1 (Koichi Sasada) * ruby -v: 3.3.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do receive # block, the problem is not the termination of the ractor but the starting end ObjectSpace.each_object(IO) { |io| p io # we get no objects } ``` -- https://bugs.ruby-lang.org/
Issue #19387 has been updated by luke-gru (Luke Gruber). It happened again :( I notified the committer of the mistake. Please reopen, thanks! ---------------------------------------- Bug #19387: Issue with ObjectSpace.each_objects not returning objects after starting a ractor https://bugs.ruby-lang.org/issues/19387#change-106176 * Author: luke-gru (Luke Gruber) * Status: Closed * Priority: Normal * Assignee: ko1 (Koichi Sasada) * ruby -v: 3.3.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do receive # block, the problem is not the termination of the ractor but the starting end ObjectSpace.each_object(IO) { |io| p io # we get no objects } ``` -- https://bugs.ruby-lang.org/
Issue #19387 has been updated by Eregon (Benoit Daloze). One idea to solve this would be to implement `ObjectSpace.each_object` like TruffleRuby does it (at least when there are multiple Ractors): basically it's just the transitive `ObjectSpace.reachable_objects_from(roots)`. I.e. it uses the same mechanism as GC traversal/marking to find every object reachable from some roots objects (like `Object` class, the stack frames, etc). Context: the latest breakage due to this bug: https://github.com/ruby/prism/pull/3491 And I know of many before, it's a very common issue that `Ractor.new` can't be used in `make test-all`. ---------------------------------------- Bug #19387: Issue with ObjectSpace.each_objects not returning objects after starting a ractor https://bugs.ruby-lang.org/issues/19387#change-112275 * Author: luke-gru (Luke Gruber) * Status: Assigned * Assignee: ko1 (Koichi Sasada) * ruby -v: 3.3.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do receive # block, the problem is not the termination of the ractor but the starting end ObjectSpace.each_object(IO) { |io| p io # we get no objects } ``` -- https://bugs.ruby-lang.org/
Issue #19387 has been updated by tenderlovemaking (Aaron Patterson). Assignee changed from ko1 (Koichi Sasada) to ractor ---------------------------------------- Bug #19387: Issue with ObjectSpace.each_objects not returning objects after starting a ractor https://bugs.ruby-lang.org/issues/19387#change-112427 * Author: luke-gru (Luke Gruber) * Status: Assigned * Assignee: ractor * ruby -v: 3.3.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do receive # block, the problem is not the termination of the ractor but the starting end ObjectSpace.each_object(IO) { |io| p io # we get no objects } ``` -- https://bugs.ruby-lang.org/
Issue #19387 has been updated by osyoyu (Daisuke Aritomo). I also ran into this, so I opened an pull request document this behavior. https://github.com/ruby/ruby/pull/13278 ---------------------------------------- Bug #19387: Issue with ObjectSpace.each_objects not returning objects after starting a ractor https://bugs.ruby-lang.org/issues/19387#change-113039 * Author: luke-gru (Luke Gruber) * Status: Assigned * Assignee: ractor * ruby -v: 3.3.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do receive # block, the problem is not the termination of the ractor but the starting end ObjectSpace.each_object(IO) { |io| p io # we get no objects } ``` -- https://bugs.ruby-lang.org/
Issue #19387 has been updated by ko1 (Koichi Sasada). Status changed from Assigned to Closed Re-checked on master 4d185cce78: this no longer reproduces. With per-Ractor GC (GH-18194) each Ractor has its own objspace, and `ObjectSpace.each_object` walks the calling Ractor's objspace directly, so it keeps working while other Ractors are alive: port = Ractor::Port.new r = Ractor.new(port) { |p| p << :up; Ractor.receive } port.receive p ObjectSpace.each_object(IO).count ruby 4.0.2 : 0 master : 3 Isolation is still respected. Letting a sub-Ractor build one unshareable and one shareable String and scanning for them from the main Ractor: 4.0.2 master own unshareable objects no yes another Ractor's unshareable objects no no another Ractor's shareable objects yes yes (the last row needs the object to have actually been made shareable; a merely frozen String that nobody has shared yet does not carry the flag and is not enumerated.) So the reported symptom -- `each_object` yields nothing once a Ractor has been started -- is gone, and `Ractor.new` can be used in `make test-all` again. One follow-up: the documentation added in GH-13278 ("Due to a current Ractor implementation issue, this method does not yield Ractor-unshareable objects when the process is in multi-Ractor mode", which links to this ticket) is now wrong. I will send a separate PR for it. ---------------------------------------- Bug #19387: ObjectSpace.each_objects only returns shareable objects after starting a Ractor https://bugs.ruby-lang.org/issues/19387#change-118831 * Author: luke-gru (Luke Gruber) * Status: Closed * Assignee: ractor * ruby -v: 3.3.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do receive # block, the problem is not the termination of the ractor but the starting end ObjectSpace.each_object(IO) { |io| p io # we get no objects } ``` -- https://bugs.ruby-lang.org/
participants (6)
-
Eregon (Benoit Daloze) -
hsbt (Hiroshi SHIBATA) -
ko1 (Koichi Sasada) -
luke-gru (Luke Gruber) -
osyoyu (Daisuke Aritomo) -
tenderlovemaking (Aaron Patterson)