From: "mame (Yusuke Endoh)" Date: 2022-10-06T05:30:13+00:00 Subject: [ruby-core:110194] [Ruby master Bug#19039] Closing an IO being select'ed in another thread does not resume the thread Issue #19039 has been reported by mame (Yusuke Endoh). ---------------------------------------- Bug #19039: Closing an IO being select'ed in another thread does not resume the thread https://bugs.ruby-lang.org/issues/19039 * Author: mame (Yusuke Endoh) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Is this intentional? ```ruby r1, w1 = IO.pipe r2, w2 = IO.pipe Thread.new do select([r1, r2]) p :ok end sleep 1 p r1.close # expected: closing r1 resumes select([r1, r2]) in the thread # actual: select([r1, r2]) continues to wait sleep 1 w2 << "foo" # Making r2 readable resumes select([r1, r2]) # And it raises an exception: closed stream (IOError) sleep 1 ``` Incidentally, IO#read is resumed by closing the IO. ```ruby r1, w1 = IO.pipe Thread.new do r1.read p :ok end sleep 1 p r1.close # Closing r1 resumes r1.read in the thread # And it raises: stream closed in another thread (IOError) sleep 1 ``` -- https://bugs.ruby-lang.org/ Unsubscribe: