# Very Strange Error(s)

**URL:** <https://www.ruby-forum.com/t/very-strange-error-s/58141>\
**Category:** Ruby\
**Created:** [April 18, 2006, 10:11pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141 "2006-04-18T22:11:28Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 18, 2006, 10:11pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/1 "2006-04-18T22:11:28Z")

</div>

Hi,

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  
running process
- 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.

Any ideas?

Thanks,  
Bob

* * *

Bob H. – blogs at \<[http://www.recursive.ca/](http://www.recursive.ca/)  
hutch/\>  
Recursive Design Inc. – [http://www.recursive.ca/](http://www.recursive.ca/)  
Raconteur – [http://www.raconteur.info/](http://www.raconteur.info/)  
xampl for Ruby – [http://rubyforge.org/projects/xampl/](http://rubyforge.org/projects/xampl/)

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 18, 2006, 10:20pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/2 "2006-04-18T22:20:47Z")

</div>

On Apr 18, 2006, at 22:10, Bob H. wrote:

> 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

This is happening here as well sporadically, and I can’t reproduce it  
either. Mac OS X 10.4.6, ruby 1.8.4 (2005-12-24) [powerpc-  
darwin8.3.0] compiled from tarball.

– fxn

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 18, 2006, 10:23pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/3 "2006-04-18T22:23:48Z")

</div>

On 4/18/06, Bob H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> 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

Are you absolutely sure that to\_i isn’t being called somewhere along  
the way (maybe in some odd cases?)

Ryan

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 18, 2006, 10:42pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/4 "2006-04-18T22:42:26Z")

</div>

On 4/18/06, Bob H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> in a loop, and I loop a few times it eventually works with identical
> 
> - 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.
> 
> Any ideas?

I’ve been experiencing this same thing on Mac OS X. I haven’t been  
able to come up with a small piece of code but it seems to happen most  
often in my network intensive and threaded code (I have a custom  
memcached client that seems to become unstable on heavy loads). I  
should also note that this has been for sometime but on extremely rare  
and hard to reproduce cases.

I am running on:

ruby 1.8.4 (2006-04-18) [powerpc-darwin8.6.0]

I can’t share the code at this point unfortunately (too large and it  
is up to my client that I am in contract with – I will try to come up  
with something I can though). Examples of traces I get (in my log  
files):

!! undefined method `wakeup' for -517611318:Fixnum /usr/local/lib/ruby/1.8/thread.rb:116:in `unlock’  
/usr/local/lib/ruby/1.8/thread.rb:137:in `synchronize’  
… long trace …

!! wrong instance allocation  
memcache/memcache.rb:209:in `exception' memcache/memcache.rb:209:in `incr’  
… long trace …

One thing I can note at this point is that it seems to always be the  
-517611318 magic number or a “wrong instance allocation” error. It  
seems to be limited to Mac OS X (I’ve not tested anything else but  
different Linux systems).

I would be happy to run any test code people might have to help narrow  
the field down. If I get any further information I will post it to  
ruby-core.

Brian.

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 18, 2006, 10:51pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/5 "2006-04-18T22:51:37Z")

</div>

I’ve not been having any of these problems myself. I’ve been running  
WEBrick for days now.

ruby 1.8.4 (2005-12-24) [powerpc-darwin8.6.0]

- Jake McArthur

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 18, 2006, 10:51pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/6 "2006-04-18T22:51:43Z")

</div>

On Apr 18, 2006, at 3:10 PM, Bob H. wrote:

> Hi,
> 
> 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.

Yeah, I’ve seen this plenty myself. I believe it is this:

[http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/7401](http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/7401)

And if I understood the discussion (way over my head), it has been  
fixed:

[http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/7477](http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/7477)

James Edward G. II

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 18, 2006, 11:10pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/7 "2006-04-18T23:10:12Z")

</div>

On 4/18/06, James Edward G. II [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Yeah, I’ve seen this plenty myself. I believe it is this:
> 
> [http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/7401](http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/7401)
> 
> And if I understood the discussion (way over my head), it has been  
> fixed:
> 
> [http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/7477](http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/7477)

Actually, from what I can tell the issue is separate (or possibly and  
unsolved factor). You might note that my post above is using a check  
out I made from stable today.

Brian.

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 18, 2006, 11:16pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/8 "2006-04-18T23:16:29Z")

</div>

On Apr 18, 2006, at 4:09 PM, Brian M. wrote:

> Actually, from what I can tell the issue is separate (or possibly and  
> unsolved factor). You might note that my post above is using a check  
> out I made from stable today.

Oops, sorry. My bad.

James Edward G. II

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 18, 2006, 11:44pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/9 "2006-04-18T23:44:04Z")

</div>

I found this \<[http://blog.segment7.net/articles/2006/04/07/chasing-](http://blog.segment7.net/articles/2006/04/07/chasing-)  
undefined-method-for-fixnum\> just now. Looks pretty relevant. Seems  
as though a re-compile with -O0 might be a work around. Some  
suggestion that using gcc 3.3 might work too.

On Apr 18, 2006, at 4:10 PM, Bob H. wrote:

> begin…rescue in a loop, and I loop a few times it eventually
> 
> - ruby 1.8.4 (2006-03-28) [powerpc-darwin8.5.0] – that’s OS X

* * *

Bob H. – blogs at \<[http://www.recursive.ca/](http://www.recursive.ca/)  
hutch/\>  
Recursive Design Inc. – [http://www.recursive.ca/](http://www.recursive.ca/)  
Raconteur – [http://www.raconteur.info/](http://www.raconteur.info/)  
xampl for Ruby – [http://rubyforge.org/projects/xampl/](http://rubyforge.org/projects/xampl/)

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 19, 2006, 9:14am UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/10 "2006-04-19T09:14:18Z")

</div>

On Apr 18, 2006, at 23:42, Bob H. wrote:

> I found this \<[http://blog.segment7.net/articles/2006/04/07/chasing-](http://blog.segment7.net/articles/2006/04/07/chasing-)  
> undefined-method-for-fixnum\> just now. Looks pretty relevant. Seems  
> as though a re-compile with -O0 might be a work around. Some  
> suggestion that using gcc 3.3 might work too.

Excellent! So just to double-check, is it an issue that has been seen  
only in OSX?

– fxn

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 19, 2006, 1:43pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/11 "2006-04-19T13:43:47Z")

</div>

On Apr 19, 2006, at 3:11 AM, Xavier N. wrote:

> On Apr 18, 2006, at 23:42, Bob H. wrote:
> 
> > I found this \<[http://blog.segment7.net/articles/2006/04/07/chasing-](http://blog.segment7.net/articles/2006/04/07/chasing-)  
> > undefined-method-for-fixnum\> just now. Looks pretty relevant.  
> > Seems as though a re-compile with -O0 might be a work around. Some  
> > suggestion that using gcc 3.3 might work too.
> 
> Excellent! So just to double-check, is it an issue that has been  
> seen only in OSX?

It sure looks that way, but I don’t know for sure. Someone thought  
that it might be happening on Windows too, but, to me, it sounded  
like a different problem. All references/hints that I’ve come across  
have been pretty recent compilations of Ruby, even though the Ruby  
version might be old. So that’s a bit of support for the work around.

I hope that work around works. Though it is nice to know I’m not  
alone 🙂

Cheers,  
Bob

> – fxn

* * *

Bob H. – blogs at \<[http://www.recursive.ca/](http://www.recursive.ca/)  
hutch/\>  
Recursive Design Inc. – [http://www.recursive.ca/](http://www.recursive.ca/)  
Raconteur – [http://www.raconteur.info/](http://www.raconteur.info/)  
xampl for Ruby – [http://rubyforge.org/projects/xampl/](http://rubyforge.org/projects/xampl/)

---

<div class="post-metadata">

**Author:** ![bobh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df705f/32.png) [@bobh](https://www.ruby-forum.com/u/bobh)\
**Post date:** [April 21, 2006, 8:21pm UTC](https://www.ruby-forum.com/t/very-strange-error-s/58141/12 "2006-04-21T20:21:48Z")

</div>

An update…

I’ve re-compiled with the compiler’s optimiser set to: -O0 and have  
not had that error come up again. However, Ruby is _very_ slow.

Also I say this today: \<[http://blog.segment7.net/articles/2006/04/20/](http://blog.segment7.net/articles/2006/04/20/)  
update-on-undefined-method-for-fixnum"\>

Cheers,  
Bob

On Apr 19, 2006, at 7:11 AM, Bob H. wrote:

> > Excellent! So just to double-check, is it an issue that has been  
> > alone 🙂
> 
> * * *
> 
> Bob H. – blogs at \<[http://www.recursive.ca/](http://www.recursive.ca/)  
> hutch/\>  
> Recursive Design Inc. – [http://www.recursive.ca/](http://www.recursive.ca/)  
> Raconteur – [http://www.raconteur.info/](http://www.raconteur.info/)  
> xampl for Ruby – \<[http://rubyforge.org/projects/](http://rubyforge.org/projects/)  
> xampl/\>

* * *

Bob H. – blogs at \<[http://www.recursive.ca/](http://www.recursive.ca/)  
hutch/\>  
Recursive Design Inc. – [http://www.recursive.ca/](http://www.recursive.ca/)  
Raconteur – [http://www.raconteur.info/](http://www.raconteur.info/)  
xampl for Ruby – [http://rubyforge.org/projects/xampl/](http://rubyforge.org/projects/xampl/)
