# DRb hanging/blocking on access to /proc filesystem

**URL:** <https://www.ruby-forum.com/t/drb-hanging-blocking-on-access-to-proc-filesystem/53977>\
**Category:** Ruby\
**Created:** [February 19, 2006, 2:30am UTC](https://www.ruby-forum.com/t/drb-hanging-blocking-on-access-to-proc-filesystem/53977 "2006-02-19T02:30:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@davidf](https://www.ruby-forum.com/u/davidf)\
**Post date:** [February 19, 2006, 2:30am UTC](https://www.ruby-forum.com/t/drb-hanging-blocking-on-access-to-proc-filesystem/53977/1 "2006-02-19T02:30:59Z")

</div>

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:

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 F.

---

<div class="post-metadata">

**Author:** ![davidf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@davidf](https://www.ruby-forum.com/u/davidf)\
**Post date:** [February 19, 2006, 3:25am UTC](https://www.ruby-forum.com/t/drb-hanging-blocking-on-access-to-proc-filesystem/53977/2 "2006-02-19T03:25:38Z")

</div>

In article [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid),  
“David F.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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].
