I’ve been encountering strange behaviour with Ruby recently. I’m
wondering if anybody has seen anything like this before or if anyone
has any ideas.
Here’s what’s happening:
- something that should be a String turns out to be an Integer
- if I run the same method call again, say by using a begin…rescue
in a loop, and I loop a few times it eventually works with identical
input – if I do run it again, and if an error occurs again, it is
usually in a different place
- long running Ruby process (actually Rails running webrick in
development mode) – I think I’ve never seen this in a short
- the frequency of the error does not seem to increase (so once it
happens it does not start happening all the time, the system seems to
be behaving properly)
- error happens during a request by the user.
- error normally quite deep in an execution stack
- ruby 1.8.4 (2006-03-28) [powerpc-darwin8.5.0] – that’s OS X
- I’ve had this happen in XML parsers (REXML and xampl-pp), in
rubyful soup, and in some code that simply prints a tree of objects
- I cannot reproduce it reliably
The going away on second or third try is particularly strange.