Forum: Ruby on Rails script/server vs mongrel_rails start issue

Posted by structuralartistry (Guest)
on 2010-06-17 16:22
(Received via mailing list)
I am having different results between when I start mongrel with script/
server and with mongrel_rails start.

When I run script/server to boot mongrel everything runs fine, no
errors.

When I run mongrel_rails start I get the following errors - verified
the problem on a fresh app and on two different environments (mac and
yes, windows server 2008). The actual line of fault changes but the
problem is always originating in /usr/local/bin/mongrel_rails:19

I would very much appreciate any ideas.

David


C:\webapps\creditcompare>mongrel_rails start -e production
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with production environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:89:in
`read': can't convert Hash into Integer (TypeError)
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
source_index.rb:89:in `load_specification'
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
source_index.rb:153:in `load_gems_in'
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
source_index.rb:152:in `each'
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
source_index.rb:152:in `load_gems_in'
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
source_index.rb:149:in `reverse_each'
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
source_index.rb:149:in `load_gems_in'
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
source_index.rb:345:in `refresh!'
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
source_index.rb:78:in `from_gems_in'
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
source_index.rb:60:in `from_installed_gems'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/
gem_plugin.rb:109:in `load'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/../lib/mongrel/configurator.rb:231:in `load
_plugins'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/mongrel_rails:117:in `cloaker_'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/../lib/mongrel/configurator.rb:149:in `call
'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/../lib/mongrel/configurator.rb:149:in `list
ener'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/mongrel_rails:99:in `cloaker_'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/../lib/mongrel/configurator.rb:50:in `call'

        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/../lib/mongrel/configurator.rb:50:in `initi
alize'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/mongrel_rails:84:in `new'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/mongrel_rails:84:in `run'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/../lib/mongrel/command.rb:212:in `run'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-
mingw32/bin/mongrel_rails:281
        from C:/Ruby187/bin/mongrel_rails:19:in `load'
        from C:/Ruby187/bin/mongrel_rails:19

C:\webapps\creditcompare>



Sun Jun 13 13:12:32 -0700 2010: Error calling Dispatcher.dispatch
#<NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]>
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
cgi.rb:108:in `send_cookies'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
cgi.rb:136:in `out'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
http_response.rb:65:in `start'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
cgi.rb:135:in `out'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
rails.rb:81:in `process'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
159:in `process_client'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
158:in `each'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
158:in `process_client'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
285:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
285:in `initialize'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
285:in `new'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
285:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
268:in `initialize'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
268:in `new'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:
268:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
configurator.rb:282:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
configurator.rb:281:in `each'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
configurator.rb:281:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:
128:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
command.rb:212:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/usr/local/bin/mongrel_rails:19:in `load'
/usr/local/bin/mongrel_rails:19
Posted by jschroe212 (Guest)
on 2010-06-17 16:22
(Received via mailing list)
We ran into the same issue.   You can follow the issue here.

https://rails.lighthouseapp.com/projects/8994/tick...

The fixes in the these posts did the trick for us:
     Edgars Beigarts May 26th, 2010 @ 07:03 PM
     bshand June 10th, 2010 @ 12:08 PM

Hope this helps!

-James
Posted by Maxim Shytikov (Guest)
on 2010-06-17 16:22
(Received via mailing list)
Hi,

First of all, I'm sorry for my English.

Looks like I found the reason of this problem:
I use REE 1.8.7, gem v=1.3.7
problem in
 ... /lib/ruby/site_ruby/1.8/rubygems/source_index.rb:89:in `read':
can't convert Hash into Integer (TypeError)

because code

   if defined? Encoding then File.read file_name, :encoding => 'UTF-8'

will work only with ruby 1.9
you can find difference here
 http://ruby-doc.org/core-1.8.7/classes/IO.html#M000467
 http://ruby-doc.org/ruby-1.9/classes/IO.html#M000125

I found that '(defined? Encoding) == true' because REXML::Encoding
loaded
Posted by DK (Guest)
on 2010-06-17 16:26
(Received via mailing list)
Thanks James - wondering if you also found that config.cache_classes = 
true
caused problems? I found that the patch + changing this setting to false
fixed things. config.cache_classes worked badly on 2.3.4 though also, so 
is
a bit strange. As for the patch, I was finding that there was a nil 
value
getting into the part of code where the patch is and that the .split was
failing as it was coming in as nil.split. Strange. Was there a reason 
you
stayed with 2.3.8 rather than just staying on an older version of rails?
Posted by Maxim Shytikov (Guest)
on 2010-06-17 16:26
(Received via mailing list)
I found in my code this
'include REXML'
removing this line helped to me fix this issue.
Try to find in your code inclusion Namspace with Encoding constant
Posted by jschroe212 (Guest)
on 2010-06-17 16:27
(Received via mailing list)
Honestly we didn't really have a reason to upgrade to 2.3.8 besides
trying to stay at the latest release.  Since I figured out a way to
get it to run I decided to keep going with 2.3.8.  As for the
cache_classes, I didn't experience any behavior like that.

-James
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.