I'm using Apache2 and Rails to host a pretty simple API that uses this: https://github.com/geocommons/geocoder
The other "load error (no such file to load)" problems I've seen online seem to happen at all times and typically in relation to gem files, but my API will get through 1000+ requests before it has this problem. The file it is unable to load is a controller in my appname/app/controller directory.
After restarting apache the API will work for roughly 1000 more requests.
Error from log file:
Started GET "/api_uri?[parameters]"
for 127.0.0.1 at [timestamp]
LoadError (no such file to load --
[dir]/app/controllers/controller_name.rb
The stack trace says something very similar, I can post it if necessary.
I've made sure all of my ruby files require "rubygems", I've made sure my path includes GEM_PATH, GEM_HOME and RUBYOPT in both my environment and my .bashrc file.
Really baffling to me since it appears to work fine at first. Any ideas?
Update: A memory leak! The Ruby process slowly climbs to ~10.5% memory usage as the requests continues, and then requests cut out. Hm
The problem here was that the Geocoder gem was not closing transactions or database connections. Fixed the code and things are now working as expected.
Related
I have installed Redmine on a shared Bluehost account and at first sight it seems to be working.
I followed both of these tutorials: https://my.bluehost.com/cgi/help/redmine and http://www.redmine.org/projects/redmine/wiki/RedmineInstall
But just as i started navigating around i noticed that there seem to be a routing problem because some of the pages are returning a 404 error code for a reason i don't understand yet.
The error log shows no information regarding this problem.
The url is on redmine.example.com , the user/pass are still admin/admin.
I have identified that any URL regarding a project is failing, for example:
http://redmine.example.com/projects/new
http://redmine.example.com/projects/21
http://redmine.example.com/projects/21/issues
(Currently i have reset the DB for privacy concerns)
In order to prove my theory that it was regarding the projects issue, i went into the projects controller file found in app/controllers/projects_controller.rb and tried to put some abort("Foo") here and there but i couldn't see my message with any of the links that are not working so i thought maybe the problem is not there and is probably in the routing process. So i checked the config/routes.rb file and comparing it with my local version they seem identical
I am not sure what to try next as i am not a Ruby developer. Let me know what kind of info you need in order to help debug this problem.
Eventually i got it working by using FastCGI.
In order to do that, i simply created a .htaccess file and a dispatcher.fcgi as shown in the answer here : Redmine 2 on Hostmonster apache fcgi: Rails application failed to start properly
Don't forget to SetEnv GEM_PATH to your ruby gems path in your .htaccess file and it should work after restarting (pkill dispatcher.fcgi)
I'm having a problem with deploying a Rails 3 app to a Passenger/Apache2/RVM server running Ubuntu 11.10.
I'm getting the error:
A source file that the application requires, is missing.
...
Error message: No such file to load -- Goal
Exception class: LoadError
Goal is one of my Rails Models.
I've seen a lot of people with a similar error message, but their issues seem to relate to missing bundles/gems - not model files! Their problems were resolved by ensuring permissions were set up correctly, so to that end I've got:
Apache running as www-data, as is Passenger. RVM is installed as www-data and I've chown'd the entire web app directory to www-data.
I've been wrestling with this for some time now and am really out of ideas - if anyone has any suggestions I'd be very grateful!
You might probably have the file structure of your Rails app wrong. Are you sure you have the "goal.rb" file within {your_app_root_url}/app/models/ ?
To me, if I am seeing the error when you view the app in browser, it seems like your rails app and passenger(with apache2) are working fine. The other possibility is you might be looking at wrong app folder which passenger is set up to.
It's hard to tell what's wrong. Please provide more details of how you set up your passenger with your rails app directory. Also it would help if you could show what's inside your app (app structure) and what's inside goal.rb model file.
Well I've solved it. Turned out that a work around for a problem with yaml encoded model archives (i.e. an explicit require of Goal) in a completely unrelated Model was causing the error to appear. Looks like it only rears its head in production - probably due to the differences between the class loaders used in development vs. production.
Tough one to find... the stack trace didn't include a reference to where the problem actually was!
I'm helping someone diagnose some slowness with their RoR applications. I'm not that deep into ruby development, but by running an strace on the ruby process, I noticed the following oddity:
For presumably every .rb file included, the ruby process checks about 110 different locations for the file to include, with all but 1 returning ENOENT. These paths include many non-existent permutations on local directories and gem installation directories. Ironically, the 8th location attempted finds the correct path, but ruby then goes on to try another 100 invalid locations before going back and opening the file it had found at the beginning of the search.
The whole search process takes almost 30ms per included .rb file, which cumulatively means that page takes so long to load that the site is unusable.
I've posted a sample of the strace output in case it is helpful here: http://pastebin.com/t9LD89dr
So, why is it doing this, and how do I make it stop?
This is a known problem with Ruby's require... apparently they're going to fix it with Ruby 1.9.3.
So, this slowness is hard to avoid when spinning up a Ruby app.
I am on the verge of actually hiring someone to fix this
for me, but I hope it doesn't come to that.
I have no experience with Rails/Ruby, but I do know my way around
computers in general.
I have two domains on one server (Hostingrails, I am beginning to hate
them more and more these days).
My secondary domain works 100% fine.
But for the past few days, my primary domain has not been working, it
has been giving me 503 Errors. I've opened a ticket regarding this, and
they told me to SSH into my server and reset "Mongrel". I've done this
using the code they gave me; "mongrel_rails start -d -e production
-p13930"
It seemed to have worked, but the problem was still there. The log says
the error is something about:
"require': no such file to load -- dispatcher (LoadError)"
I've re-opened a ticket concerning this, and Hostingrails basically told
me that it is not their problem anymore and that it's solely up to me to
fix it. Brilliant.
So I spent a good part of the day looking and changing things around
through SSH (probably wasn't the greatest idea) but I still keep getting
503'd on my website.
However, I recently found out that my index file HAS to be index.html,
or it will not render the page. index.htm or index.php will result in a
503. If I set the index page to index.html, it worked. Which is strange,
my htaccess file allowed for all.
Another problem, I think I have inadvertently changed something in my
settings while I was SSH'd in. When I do "bundle install" it installs
the gems into my own private webspace, for example /home/mywebsite. But
I believe on my shared plan, all the rails/ruby/gems etc are all under
/usr/local/rvm/gems/ruby-1.9.2-p0/ which I don't think I have access to.
How do I change the directory to the default one? For example, before
the error log said:
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require': no such file to load -- dispatcher (LoadError)
Now it says:
/home/mysite/.gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require': no such file to load -- dispatcher (LoadError)
I think that's everything for now. Here are the rails installed on my
server by the host:
Installed at (3.0.0): /usr/local/rvm/gems/ruby-1.9.2-p0
(2.3.8): /usr/local/rvm/gems/ruby-1.9.2-p0
(again, I think my mongrel is looking in the wrong place, as my gems are
now being installed into /home/mywebsite/ instead of
/usr/local/rvm/gems/) Is it possible to someone reset the settings I've
changed back into my host's default one?
Would anyone be willing to take the time and try and fix this with me? I
am pretty annoyed at Hostingrails, since I didn't do anything to create
this problem, and they are outright refusing to help me. Why is my
primary domain getting 503 errors when my secondary domain works fine?
Mongrel is not compatible to ruby 1.9.2. You need use a fork of mongrel to use it https://github.com/kyusik/mongrel_cluster
I advice you to user thin/passenger or unicorn instead of mongrel.
I found a little blog post about problem with Mongrel and ruby 1.9.2 http://xaop.com/blog/2010/08/04/deploying-rails-3-on-ruby-1-9-2/
Maybe you could try using Ruby 1.8.7 - it causes less trouble in general at this time.
Not an answer to your question in particular, but if you're new to Ruby and Rails, then hosting your own stuff can be a daunting task.
Instead, try Heroku - simply push your Rails app to Heroku with git and you're good to go. They support custom domainnames for free.
Today, for no reason, my rails(2.1.0) application is very slow or even not responding.
It happens intermittently.
So sometimes it works but again it doesn't work.
When it doesn't work, I can't even load 'script/console production'.
I want to know where it's stuck.
How do I load console step-by-step so that I can know which part causes the problem?
Thanks.
Sam
You could be running out of memory on your server and so the machine can't respond to you. If you are running mongrel then get monit onto it to limit the memory it can use and restart where necessary.
If you are using Passenger, try limiting the amount of instances, and if you have already done that look up a script that kills passenger instances when too big via a cron job.
If it's not a memory issue then I'd probably need more information.
If you are able, try temporarily removing all plugins/gems and see if the app will boot. One of those is likely the problem.
The script/console file contains this.
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
You can find the commands/console file here for Rails 2.1.
I recommend loading up irb and trying to load your app from there.
require 'config/boot'
If that works, then try stepping through the rest of the mentioned commands/console script to find out which part is the problem.
If the boot file won't load, take a look at that config/boot.rb file to see if you can determine which part isn't working. Good luck!
When all else fails, you should be able to use strace to debug what the script/application is actually doing. Note that this should only be one of the last resorts as it produces extremely verbose information (and also mostly limited to I/O actions).
Try using 'strace script/console production' for example