Chasing "undefined method for Fixnum"

Eric Hodel | Fri, 07 Apr 2006 17:28:35 GMT

Posted in

I’ve been running the unit tests for 43 People on my Powerbook since the shared development box slowed to a crawl after importing the entire production database and I’m now seeing the “undefined method [blah] for -517611318:Fixnum” message occasionally on my Powerbook. Not content to suffer through running another thirty seconds of tests I reached into eval.c and added a call to rb_bug() when method_missing is called on the Fixnum -517611318.

Within a couple runs of the tests I ended up with a core, but the NODE * argument to rb_eval() was 0×0 for all calls. This made no sense, that value can’t possibly be 0×0 for every call to rb_eval, the optimization flags must have been getting in the way.

So I rebuilt Ruby with -O0 and haven’t gotten a core since. So one of the optimizations that -O or -O2 makes is screwing up Ruby’s internals. Now I’m trying a -O1 build to see if I can reproduce. If I don’t get any problems with -O1 I’ll try sorting through -O2’s flags until I find the culprit.

11 comments

Comments RSS FEED

This would be a great bug to track down. It’s been one of those ghosts that have been haunting Ruby for a while, now. I look forward to your results.

Dan

Daniel Berger said about 1 hour later

Awesome, I have been bothered by this as well. I also look forward to hearing the results.

J. Weir said about 4 hours later

Hi Eric,

I was having the same problem with my installation of Ruby 1.8.2 on Tiger (PPC). I recompiled Ruby using gcc 3.3 (rather than 4, which the original version was compiled with) and it hasn’t happened since then.

A few days ago I upgraded to 1.8.4, compiled with gcc 4 and still haven’t seen it. Interesting, no?

David Felstead said about 4 hours later

Bless you! Thank you for taking on this bug! You should get a reward when you track it down.

Just out of curiosity, does anyone know if this is only a problem with gcc on the PowerPC platform, or is it with gcc in general?

Bob said about 5 hours later

David: I originally discovered that GCC 3.3 seems to fix the bug on PPC.

Saying “Use GCC 3.3” is no real solution. I don’t want to recompile everything with GCC 3.3 and I don’t want to tell everybody else to do that either.

I typically hit the bug when running Rails’ unit tests so it may require a good workout for the GC to trigger.

Eric Hodel said about 5 hours later

Bob: Should you feel the need, you can reward me with beer.

Eric Hodel said about 5 hours later

+1 thanks for looking

Caleb said about 10 hours later

I got this bug on windows.

I am using ruby 1.8.2 / rails 1.0 / ms sqlserver 2000, (because my project used memcached , so i can not use rails 1.1 now.)

i found that the but occurrent because the database table have a column named ‘type’, and i change the column name to solved this problem.

Caiwangqin said 2 days later

Caiwangqin: I don’t understand how you fixed this bug by changing a database table name. It has nothing to do with Rails. Can you give more details?

Eric Hodel said 2 days later

this bug occur in my rails app only if database table has a column named ruby key word or object intanse method name, so i can rename column name to fix it.

Caiwangqin said 3 days later

Sounds like a different bug. I can see this bug sometimes without using Rails at all.

Eric Hodel said 4 days later

Comments are disabled