Rails app crashing on dreamhost

Hi All,

Wondering if anybody has seen this issue. I have a rails 3.2 app I am
trying to host on dreamhost. I am using FastCGI. When I attempt to
access the site, I get the “Rails application failed to start properly”
error. I’ve determined that the ruby binary is crashing, and it is
producing a core file in the public directory of my app. I’ve also
determined that the crash is happening when the following line in the
application.rb file is executed:

Bundler.require(*Rails.groups(:assets => %w(development test)))

I have precompiled my assets. I’ve also tried without precompiling
assets and using the alternate line in application.rb for lazy
compilation of assets:

Bundler.require(:default, :assets, Rails.env)

I get the same result either way. Note that I’ve put logging into
application.rb to determine on which line the crash is happening. I get
the log message from immediately before the lines shown above, but I
don’t get the log message that immediately follows them.

Below is a backtrace from the core file, along with my .htaccess,
dispatch.fcgi, and config/application.rb files. Been fighting with this
since yesterday with no luck. Anybody have a clue as to what could be
wrong? Thanks for any help.

backtrace of ruby binary from gdb:

(gdb) backtrace
#0 0x000068a0b474ced5 in raise () from /lib/libc.so.6
#1 0x000068a0b474e3f3 in abort () from /lib/libc.so.6
#2 0x000068a0af96c8c9 in v8::internal::OS::Abort () from
/home/davlev16/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.9.9/ext/v8/v8.so
#3 0x000068a0af86b183 in API_Fatal () from
/home/davlev16/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.9.9/ext/v8/v8.so
#4 0x000068a0af83e533 in v8::DefaultFatalErrorHandler () from
/home/davlev16/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.9.9/ext/v8/v8.so
#5 0x000068a0af83b50b in v8::IsDeadCheck () from
/home/davlev16/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.9.9/ext/v8/v8.so
#6 0x000068a0af83c8d9 in v8::V8::AddGCPrologueCallback () from
/home/davlev16/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.9.9/ext/v8/v8.so
#7 0x000068a0af835cd5 in Init_v8 () at v8.cpp:29
#8 0x0000000000594678 in dln_load (file=0x2963300
“/home/davlev16/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.9.9/ext/v8/v8.so”)
at dln.c:1337
#9 0x000000000051e505 in rb_vm_call_cfunc (recv=9085920, func=0x57f060
<load_ext>, arg=25806080, blockptr=0x1, filename=)
at vm.c:1538
#10 0x000000000057ff42 in rb_require_safe (fname=25819360, safe=0) at
load.c:623
#11 0x000000000051f917 in vm_call_method (th=0x845240,
cfp=0x68a0b5755408, num=1, blockptr=0x1, flag=8, id=9008, me=0x125bf50,
recv=25763320) at vm_insnhelper.c:404
#12 0x0000000000520f91 in vm_exec_core (th=0x845240, initial=) at insns.def:1015
#13 0x0000000000526637 in vm_exec (th=0x845240) at vm.c:1220
#14 0x0000000000526be2 in rb_iseq_eval (iseqval=25766280) at vm.c:1447
#15 0x000000000057ead5 in rb_load_internal (fname=25692560, wrap=) at load.c:310
#16 0x000000000057fe2f in rb_require_safe (fname=25667000, safe=0) at
load.c:619
#17 0x000000000051f917 in vm_call_method (th=0x845240,
cfp=0x68a0b5755568, num=1, blockptr=0x1, flag=8, id=9008, me=0x125bf50,
recv=9085920) at vm_insnhelper.c:404
#18 0x0000000000520f91 in vm_exec_core (th=0x845240, initial=) at insns.def:1015
#19 0x0000000000526637 in vm_exec (th=0x845240) at vm.c:1220
#20 0x0000000000526be2 in rb_iseq_eval (iseqval=25650640) at vm.c:1447
#21 0x000000000057ead5 in rb_load_internal (fname=25498000, wrap=) at load.c:310
#22 0x000000000057fe2f in rb_require_safe (fname=25491000, safe=0) at
load.c:619
#23 0x000000000051f917 in vm_call_method (th=0x845240,
cfp=0x68a0b5755670, num=1, blockptr=0x1, flag=8, id=9008, me=0x125bf50,
recv=9085920) at vm_insnhelper.c:404
#24 0x0000000000520f91 in vm_exec_core (th=0x845240, initial=) at insns.def:1015
#25 0x0000000000526637 in vm_exec (th=0x845240) at vm.c:1220
#26 0x0000000000526be2 in rb_iseq_eval (iseqval=25462800) at vm.c:1447
#27 0x000000000057ead5 in rb_load_internal (fname=25381480, wrap=) at load.c:310
#28 0x000000000057fe2f in rb_require_safe (fname=25371680, safe=0) at
load.c:619
#29 0x000000000051f917 in vm_call_method (th=0x845240,
cfp=0x68a0b5755778, num=1, blockptr=0x1, flag=8, id=9008, me=0x125bf50,
recv=9085920) at vm_insnhelper.c:404
#30 0x0000000000520f91 in vm_exec_core (th=0x845240, initial=) at insns.def:1015
#31 0x0000000000526637 in vm_exec (th=0x845240) at vm.c:1220
#32 0x0000000000526be2 in rb_iseq_eval (iseqval=25372840) at vm.c:1447
#33 0x000000000057ead5 in rb_load_internal (fname=25316640, wrap=) at load.c:310
#34 0x000000000057fe2f in rb_require_safe (fname=24966880, safe=0) at
load.c:619
#35 0x000000000051f917 in vm_call_method (th=0x845240,
cfp=0x68a0b5755880, num=1, blockptr=0x1, flag=8, id=9008, me=0x125bf50,
recv=9085920) at vm_insnhelper.c:404
#36 0x0000000000520f91 in vm_exec_core (th=0x845240, initial=) at insns.def:1015
#37 0x0000000000526637 in vm_exec (th=0x845240) at vm.c:1220
#38 0x0000000000526be2 in rb_iseq_eval (iseqval=24773880) at vm.c:1447
#39 0x000000000057ead5 in rb_load_internal (fname=18099240, wrap=) at load.c:310
#40 0x000000000057fe2f in rb_require_safe (fname=17799040, safe=0) at
load.c:619
—Type to continue, or q to quit—
#41 0x000000000051f917 in vm_call_method (th=0x845240,
cfp=0x68a0b5755988, num=1, blockptr=0x1, flag=0, id=9008, me=0x948880,
recv=9090600) at vm_insnhelper.c:404
#42 0x0000000000520f91 in vm_exec_core (th=0x845240, initial=) at insns.def:1015
#43 0x0000000000526637 in vm_exec (th=0x845240) at vm.c:1220
#44 0x000000000052eca9 in rb_yield (val=13799760) at vm.c:654
#45 0x0000000000543987 in rb_ary_each (array=) at
array.c:1478
#46 0x000000000051f917 in vm_call_method (th=0x845240,
cfp=0x68a0b5755a90, num=0, blockptr=0x68a0b5755ab9, flag=0, id=424,
me=0x908550, recv=17800120) at vm_insnhelper.c:404
#47 0x0000000000520f91 in vm_exec_core (th=0x845240, initial=) at insns.def:1015
#48 0x0000000000526637 in vm_exec (th=0x845240) at vm.c:1220
#49 0x000000000052eca9 in rb_yield (val=13791320) at vm.c:654
#50 0x0000000000543987 in rb_ary_each (array=) at
array.c:1478
#51 0x000000000051f917 in vm_call_method (th=0x845240,
cfp=0x68a0b5755b98, num=0, blockptr=0x68a0b5755bc1, flag=0, id=424,
me=0x908550, recv=14261400) at vm_insnhelper.c:404
#52 0x0000000000520f91 in vm_exec_core (th=0x845240, initial=) at insns.def:1015
#53 0x0000000000526637 in vm_exec (th=0x845240) at vm.c:1220
#54 0x0000000000526be2 in rb_iseq_eval (iseqval=8912200) at vm.c:1447
#55 0x000000000057ead5 in rb_load_internal (fname=8972200, wrap=) at load.c:310
#56 0x000000000057fe2f in rb_require_safe (fname=8974400, safe=0) at
load.c:619
#57 0x000000000051f917 in vm_call_method (th=0x845240,
cfp=0x68a0b5755d50, num=1, blockptr=0x1, flag=8, id=14408, me=0xa94c30,
recv=9085920) at vm_insnhelper.c:404
#58 0x0000000000520f91 in vm_exec_core (th=0x845240, initial=) at insns.def:1015
#59 0x0000000000526637 in vm_exec (th=0x845240) at vm.c:1220
#60 0x0000000000526be2 in rb_iseq_eval (iseqval=8975960) at vm.c:1447
#61 0x000000000057ead5 in rb_load_internal (fname=8984360, wrap=) at load.c:310
#62 0x000000000057fe2f in rb_require_safe (fname=8990040, safe=0) at
load.c:619
#63 0x000000000051f917 in vm_call_method (th=0x845240,
cfp=0x68a0b5755eb0, num=1, blockptr=0x1, flag=8, id=14408, me=0xa94c30,
recv=9085920) at vm_insnhelper.c:404
#64 0x0000000000520f91 in vm_exec_core (th=0x845240, initial=) at insns.def:1015
#65 0x0000000000526637 in vm_exec (th=0x845240) at vm.c:1220
#66 0x00000000005269c0 in rb_iseq_eval_main (iseqval=11133160) at
vm.c:1461
#67 0x0000000000417d23 in ruby_exec_internal (n=0xa9e0e8) at eval.c:204
#68 0x0000000000419f96 in ruby_run_node (n=) at
eval.c:251
#69 0x0000000000416f4d in main (argc=2, argv=0x771ddad45b48) at
main.c:38
(gdb)

======================================================================
.htaccess file:

[canopus]$ cat .htaccess
SetEnv GEM_HOME /home/davlev16/local/lib/ruby/gems/1.9.1
SetEnv GEM_PATH /home/davlev16/local/lib/ruby/gems/1.9.1
SetEnv RUBYOPT ‘-rbundler/setup’

AddHandler fastcgi-script .fcgi
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi

Options +FollowSymLinks +ExecCGI

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]

ErrorDocument 500 “Rails application failed to start properly”
[canopus]$

======================================================================
dispatch.fcgi file:

[canopus]$ cat dispatch.fcgi
#!/home/davlev16/local/bin/ruby

require ‘logger’
logger = Logger.new(’/home/davlev16/wm/log/dispatch.log’);
logger.info “a”
require ‘rubygems’
require ‘fcgi’

ENV[‘RAILS_ENV’] ||= ‘production’

logger.info “b”

Set GEM_PATH and GEM_HOME (“user” is your dreamhost user)

ENV[‘GEM_HOME’] = ‘/home/davlev16/.gems’
ENV[‘GEM_PATH’] =
‘/home/davlev16/.gems:/home/davlev16/local/lib/ruby/gems/1.9.1’
require ‘rubygems’
Gem.clear_paths

logger.info “c”
logger.info File.join(File.dirname(FILE), ‘…/config/environment’)
require File.join(File.dirname(FILE), ‘…/config/environment’)

logger.info “d”
class Rack::PathInfoRewriter
def initialize(app)
@app = app
end

def call(env)
env.delete(‘SCRIPT_NAME’)
parts = env[‘REQUEST_URI’].split(’?’)
env[‘PATH_INFO’] = parts[0]
env[‘QUERY_STRING’] = parts[1].to_s
@app.call(env)
end
end

logger.info “e”
Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(Wm::Application)
logger.info “f”
[canopus]$

======================================================================
application.rb file:

[canopus]$ cat application.rb
require File.expand_path(’…/boot’, FILE)

require ‘rails/all’

if defined?(Bundler)
require ‘logger’
logger = Logger.new(’/home/davlev16/wm/log/application.log’);
logger.info “A4”

If you precompile assets before deploying to production, use this

line
Bundler.require(*Rails.groups(:assets => %w(development test)))

If you want your assets lazily compiled in production, use this line

Bundler.require(:default, :assets, Rails.env)

logger.info “A5”
end

module Wm
class Application < Rails::Application
# Settings in config/environments/* take precedence over those
specified here.
# Application configuration should go into files in
config/initializers
# – all .rb files in that directory are automatically loaded.

# Custom directories with classes and modules you want to be

autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)

# Only load the plugins named here, in the order given (default is

alphabetical).
# :all can be used as a placeholder for all plugins not explicitly
named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all
]

# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector,

:forum_observer

# Set Time.zone default to the specified zone and make Active Record

auto-convert to this zone.
# Run “rake -D time” for a list of tasks for finding time zone
names. Default is UTC.
# config.time_zone = ‘Central Time (US & Canada)’

# The default locale is :en and all translations from

config/locales/.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join(‘my’, ‘locales’,
'
.{rb,yml}’).to_s]
# config.i18n.default_locale = :de

# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"

# Configure sensitive parameters which will be filtered from the log

file.
config.filter_parameters += [:password]

# Use SQL instead of Active Record's schema dumper when creating the

database.
# This is necessary if your schema can’t be completely dumped by the
schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql

# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for

mass-assignment for all models
# in your app. As such, your models will need to explicitly
whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected
declaration.
# config.active_record.whitelist_attributes = true

# Enable the asset pipeline
config.assets.enabled = true

# Version of your assets, change this if you want to expire all your

assets
config.assets.version = ‘1.0’
end
end
[canopus]$