Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 0.5.4
-
Component/s: Block Device
-
Labels:None
-
Environment:
Linux localhost.localdomain 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux, though other kernels of similar vintage are probably similarly affected
Description
The block device plugin has code that evaluates to this:
File.read("/sys/block/md0/size")
This uses a select() call internally:
[root@localhost ~]# strace -p 8000
Process 8000 attached - interrupt to quit
select(4, [3], [], [], NULL <unfinished ...>
lsof -p 8000
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
...
ruby 8000 root 3r REG 0,0 4096 6104 /sys/block/md0/size
but the call to select() hangs forever (even though it should not):
irb(main):001:0> f=File.open("/sys/block/md0/size")
=> #<File:/sys/block/md0/size>
irb(main):002:0> IO.select([f], nil, nil, nil)
# hangs forever
So this plugin should be modified to use read_nonblock, which does not hang.
Issue Links
- relates to
-
OHAI-366
Fix for older linux kernels and blocking read of /proc/* files in virtualization plugin
-
See also: http://gist.github.com/441278 for code to repro the root bug outside of ruby.