Project

General

Profile

Actions

Bug #7908

closed

Blocking IO.open stops Thread.new from returning.

Added by jamesotron (James Harton) over 11 years ago. Updated over 11 years ago.

Status:
Rejected
Assignee:
-
Target version:
ruby -v:
ruby 1.8.7 (2012-10-12 patchlevel 371) [i686-darwin12.2.1]
[ruby-core:52633]

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]

Actions

Also available in: Atom PDF

Like0
Like0