Issue #11060 has been updated by Nobuyoshi Nakada. Franck Verrot wrote: > I can't reproduce the same errors without correcting the typo (or I'm getting a `NameError: undefined local variable or method ```pi' for main:Object` in the threads). It's your typo, not `pi` but `p i`. > Once running, it seems that loading from a FIFO isn't supported (it's expecting a regular file). Here's a patch for making `load` work with FIFO files. It's a different story, please file a new ticket if you think it useful. Motohiro KOSAKI wrote: > 本筋ではないんですが、fstatのエラーを無視するように変えてしまっているのはいいんでしょうか もちろんダメです。 ---------------------------------------- Bug #11060: load(fifo) blocks whole process https://bugs.ruby-lang.org/issues/11060#change-52912 * Author: Akira Tanaka * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.3.0dev (2015-04-12 trunk 50257) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- fifo を load しようとすると、プロセス全体がブロックします。 以下では、0.1 秒毎に表示を行うスレッドを作っていますが、 0.5 秒後に load が呼ばれると表示が途切れます。 ``` % mkfifo fifo.rb % ls -l fifo.rb prw-r--r-- 1 akr akr 0 Apr 12 17:13 fifo.rb % ./ruby -ve 'Thread.new { 0.step {|i| p i; sleep 0.1 } }; sleep 0.5; load "fifo.rb"' ruby 2.3.0dev (2015-04-12 trunk 50257) [x86_64-linux] 0 1 2 3 4 ^C5 -e:1:in `new': Interrupt from -e:1:in `load' from -e:1:in `<main>' ``` 当然、timeout も効きません。 ``` % ./ruby -rtimeout -ve 'Thread.new { 0.step {|i| p i; sleep 0.1 } }; sleep 0.5; timeout(1) { load "fifo.rb" }' ruby 2.3.0dev (2015-04-12 trunk 50257) [x86_64-linux] 0 1 2 3 4 ^C5 -e:1:in `new': Interrupt from -e:1:in `load' from -e:1:in `block in <main>' from /home/ruby/tst1/lib/ruby/2.3.0/timeout.rb:89:in `block in timeout' from /home/ruby/tst1/lib/ruby/2.3.0/timeout.rb:34:in `block in catch' from /home/ruby/tst1/lib/ruby/2.3.0/timeout.rb:34:in `catch' from /home/ruby/tst1/lib/ruby/2.3.0/timeout.rb:34:in `catch' from /home/ruby/tst1/lib/ruby/2.3.0/timeout.rb:104:in `timeout' from /home/ruby/tst1/lib/ruby/2.3.0/timeout.rb:125:in `timeout' from -e:1:in `<main>' ``` この挙動をバグと考えるべきかどうかはいまひとつ確信が持てないのですが、 いまのところバグであってもおかしくないと思っています。 ---Files-------------------------------- 0001-file.c-load-now-supports-reading-from-a-FIFO-file.patch (3.26 KB) -- https://bugs.ruby-lang.org/