views:

850

answers:

6

I have problems installing any Ruby On Rails app on my shared hosted server. Mongrel shows html as plain text for all pages. The problem occurs for any app, even if I create a test empty app and add a scaffolded view without changing anything.

It appears that the Mongrel crashes when trying to put cookies to the response header. The HTTP header looks incomplete, the Content-type and other parameters are missing:

curl 127.0.0.1:12002/users -I
HTTP/1.1 200 OK
Connection: close
Date: Wed, 26 May 2010 09:46:50 GMT
Content-Length: 0

Here is the output from mongrel.log

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/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in `send_cookies'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:in `out'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response.rb:65:in `start'

ruby 1.8.7 rails 2.3.8 mongrel 1.1.5

Here is the link to the test page.

Has anyone seen anything like this?

A: 

Yes, my apps that worked ok with rails 2.3.5 and mongrel (and mongrel_cluster / pen) will fail with rails 2.3.8. For me it seems rails cannot put data in session (db:sessions) any more, so my login will always fail. See also here.

VanJeje
A: 

I'm also seeing this. Upgraded 2.3.5 apps to 2.3.8.

Using mongrel, behind apache 2.2.3.

Running with webrick or thin locally works fine, using mongrel does not.

Matt Jankowski
A: 

I can confirm this. I upgraded a very new Rails app from 2.3.5 to 2.3.8, running Mongrel 1.1.5 on Windows. Any requests going through the router (ie: not static files in /public) cause this error to happen.

davidstamm
A: 

got the same, ruby 1.8.7, rails 2.3.8, mongrel 1.3.5. strange cuz works fine on localhost but on hosting I have ActionController::InvalidAuthenticityToken issues

Artur79
A: 

I posted a solution here:

https://rails.lighthouseapp.com/projects/8994/tickets/4690

Let me know if it works for you.

Thanks, Mike C

Mike C
Thank you for your answer. Unfortunately I'm not qualified to make fixes to source code of the framework. For now I've just rolled back to 2.3.5 and will be waiting for version 3.
Evgeny
A: 

Hello,

In my case, this exact problem occurred when running mongrel with the "mongrel_rails" command. Using "script/server" command (which also launches mongrel if it's present) solved the issue.

Maybe you could write to your webhosting provider to check on this.

foresth