This is a long standing bug in Ruby, and has been reported hundreds of times
by myself and many other people, but never addressed. Unfortunately, the
usual response is "Give a small code example reproducing the problem", which
is impossible (given the nature of the bug), so it gets overlooked.
Common themes seem to be
1) Its pretty random
2) Changing a source file, even by adding white space, often causes the
problem to appear/dissappear
3) Test cases are worthless. It will undoutedly work on your machine. This is
undoutedly some sort of nasty random read/write scribble bug.
These are other reports (A quick search on google/groups find 330+)
http://www.talkaboutprogramming.com/group/comp.lang.ruby/messages/116486.html
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/63237
http://www.generic-nic.net/dyn/mon/detail?tld=.pr_Puerto_Rico
http://rubyforge.org/forum/forum.php?forum_id=1126
...
The problem is serious. It bites me, and many others, frequently. I use ruby
based init scripts for my Rubyx linux distro, which is about as mission
critical as it gets.
I have offered opportunities to debug a reproducible test case on one of my
servers (see my previous post to ruby-core), but nobody seems interested. My
time and resources are at your disposal; I am record as having already spent
considerable time trying to solve this already.
I love ruby and don't want to have to migrate away, but I _need_ reliability,
and it's looking like my only option.
Yours, having a bad day,
Andrew Walrond
[ Imagine; Rubyx becomes Pythix, or Perlix - Yuk!
]
FWIW and for other sufferers, (my) empirical evidence suggests that building
ruby with debug info (-g) makes the problem dissappear ... mostly ...