[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

DRb hanging/blocking on access to /proc filesystem

David Felstead

2/19/2006 1:23:00 AM

Hi all,

The following code causes ruby to hang on Linux CentOS 4 (tested on
1.8.2, 1.8.3, 1.8.4 and 1.9 HEAD as of last night):

====
#!/usr/bin/env ruby
require 'drb'

# This works fine
File.read('/proc/loadavg')

# Start the DRb server thread
DRb.start_service

# This works fine - accessing normal file
File.read('/etc/passwd')

# This call causes the program to hang
File.read('/proc/loadavg')
===

It seems that attempting to access anything in the /proc filesystem
causes DRb to block on a select call, as evident in this strace:

<strace snip>
open("/proc/loadavg", O_RDONLY|O_LARGEFILE) = 4
fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7d32000
_llseek(4, 0, [0], SEEK_CUR) = 0
select(5, [3 4], [], [], NULL

The fd's that select is waiting on are these:
lrwx------ 1 dfelstead dfelstead 64 Feb 18 20:18 3 -> socket:[1130388]
lr-x------ 1 dfelstead dfelstead 64 Feb 18 20:18 4 -> /proc/loadavg

This happens regardless of the way that DRb is opened, whether or not
it is in a separate thread or not, etc. I've also had it happen when
accessing other, normal fs files, (it blocks on an 'accept' call in
that case) but I haven't been able to reproduce it relaibly. This
example fails every time for me.

Any ideas?

Cheers!

-David Felstead

1 Answer

Tanaka Akira

2/19/2006 2:23:00 AM

0

In article <1140312204.751553.136640@g43g2000cwa.googlegroups.com>,
"David Felstead" <david.felstead@gmail.com> writes:

> The following code causes ruby to hang on Linux CentOS 4 (tested on
> 1.8.2, 1.8.3, 1.8.4 and 1.9 HEAD as of last night):

> # This call causes the program to hang
> File.read('/proc/loadavg')

It seems like the problem before Linux 2.6.13.
See [ruby-talk:155745].
--
Tanaka Akira