[#86520] [Ruby trunk Bug#14681] `syswrite': stream closed in another thread (IOError) — samuel@...
Issue #14681 has been reported by ioquatix (Samuel Williams).
3 messages
2018/04/12
[#86755] [Ruby trunk Feature#14723] [WIP] sleepy GC — normalperson@...
Issue #14723 has been reported by normalperson (Eric Wong).
6 messages
2018/04/29
[ruby-core:86655] cross-thread IO#close semantics
From:
Eric Wong <normalperson@...>
Date:
2018-04-23 13:39:46 UTC
List:
ruby-core #86655
Related to the discussion on [Bug #14681]
I found an old Ruby 1.8 installation, and the following code
exits after 100ms with: [IOError, "stream closed"]
1.9 and later hangs forever:
r, w = IO.pipe
th = Thread.new do
begin
IO.select([r])
rescue => e
warn [ e.class, e.message ].inspect
end
end
sleep 0.1
r.close
th.join
Of course I know why: it's not implemented in 1.9+;
rb_thread_io_blocking_region only cares for operations on the
single FD case, multiplexing functions like select aren't
supported. I could implement it, but it has overhead and maybe
nobody cares for this feature. IO.select is an inefficient API
anyways
This also pertains to [Feature #13618] for auto-fiber/green thread
support or whatever it will be called.
If I replace IO.select with single FD operation which hits
rb_thread_io_blocking_region in 1.9+ such as "r.read", then Ruby
behaves consistently in 1.8/1.9/2.x
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>