mirror of
https://github.com/ruby/ruby.git
synced 2026-07-31 09:25:15 +08:00
Ractor::Port has a public allocator, so Ractor::Port.allocate returns a port whose owner Ractor is still NULL; only ractor_port_init() fills it in. The methods dereferenced it unchecked: Ractor::Port.allocate.closed? # [BUG] Segmentation fault at 0x60 Route the paths reachable from Ruby through ractor_port_ptr_check(), which raises TypeError as other uninitialized typed data objects do. The self of #initialize_copy keeps the unchecked accessor because it is legitimately uninitialized there; only orig is checked. Ractor.select did not crash, but such a port has id 0, the same as the current Ractor's default port, so it took messages from it. Port#closed? also loses Primitive.attr! :leaf. It can raise now, and it was not a leaf before either, since the foreign Ractor path takes RACTOR_LOCK(). [Bug #22214]