English 中文(简体)
Ruby Interpreter crashes with a certain word
原标题:

Ok, this one s a little ridiculous, and I m almost afraid no one will believe me. But here it goes:

I have written a Ruby Rails application that handles content for tons of domains. Now I know this breaks the cardinal rule of Rails, but each domain has all of its information housed in a config file. I know this is probably wrong, but it is how it is setup right now, and it won t too soon (though it will). Anyway, the name of the domain you want to view is passed in as a parameter (at least in development). This parameter is used to open up the config file of the same name. This means that if I want to view the content for domain xxx, I need to enter (with a Mongrel server active) http://localhost:3000?name=xxx. Rails will refer to xxx.xml, and pull out the necessary info.

This has worked fine for all of the domains so far. It has been easy to generate config files and change them accordingly. Except, now there is a domain that, when I try to view it, crashes the Ruby Interpreter. After testing it, the only thing that causes a problem is the actual domain name, which is pumarunningshoes.com. When I changed the word puma to luma, it worked fine. When I changed it back, everything crashed again. So, I must conclude that Rails, or Mongrel, hates the word "puma". Why is this? Is it a reserved word, or function I do not know about?

Thanks for your help!

问题回答

Ok, I kind of fixed it. I hate to admit this, as it is rather embarassing. However, in the spirit of SO, which is dedicated to learning, I will describe my solution.

Basically, I went line-by-line through the controller method that was called for this domain. I found out that one of my methods, which has worked for every other domain, is somehow failing on this one. When I removed the method calls and the associated view stuff, it suddenly worked.

I made an assumption that if it worked for every other domain, that it would work for this one as well. I didn t do anything different for this one. So now I have to figure out why the method fails on this one. But at least I got it working.

I appreciate all of your help. Thank you, SO community!

Actually you should be able to attach GDB to a running mongrel process and simulate the crash (since you already know it happens when domain is set to particular string x ) pretty easily.

For more information see Gdb wrapper for ruby

Once you have the place where its crashing (or segfaulting), either update this thread with backtrace you got in gdb or mail the backtrace to ruby-core.





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签