Bug #7908
closedBlocking IO.open stops Thread.new from returning.
Description
When calling File.open on a FIFO the open will block until both ends of the FIFO are open. When creating a new thread to handle this blocking on Ruby 1.8.7 we discover that Thread.new never returns, consider:
require 'tempfile'
t = Tempfile.new('fifo')
fifo = t.path
t.close ; t.unlink
`mkfifo #{fifo}`
Thread.new { File.open(fifo, 'r') }
puts "Never arrived here :("
I have tested on Ruby 1.8.7p371 on OSX and 1.8.7p352 on Linux. Interestingly on Linux it seems to eat CPU while it's waiting, whereas on OSX the process is idle.
Relevant ruby -v output:
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
ruby 1.8.7 (2012-10-12 patchlevel 371) [i686-darwin12.2.1]
Updated by drbrain (Eric Hodel) over 11 years ago
- Status changed from Open to Rejected
Ruby 1.8.7 has reached its end-of-life for bug fixes so we must reject this ticket:
http://www.ruby-lang.org/en/news/2011/10/06/plans-for-1-8-7/
The end-of-life for security fixes is quickly approaching (June), so we recommend you upgrade to ruby 1.9 or the upcoming 2.0.