Forum: Ruby on Rails Internal Server Error - I want to cry

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joe (Guest)
on 2006-03-06 22:53
I got a brand new Fedora Core 4 box and was all excited to get Rails
running on it. That was about two days ago. I did all the 'yum install
ruby, etc. etc. etc.', then 'gem install rails, etc. etc. etc'. I've
tried running Rails with httpd (fastcgi and cgi), lighttpd (scgi,
fastcgi, cgi), mongrel, webrick, and even 'ruby
public/dispatch.cgi|fcgi|rb' and NONE of them work; they all display
'500: internal server error' or 'Rails application failed to start
properly'.

'ruby -w public/dispatch.fcgi|cgi|rb' displays a ton of warnings (things
like 'ambiguous first argument', 'method redefined', 'instance variable
not initialized', etc., but no errors that appear to be show-stoppers).
And that's about it - there is NOTHING helpful in any of httpd's,
lighty's, Rails', etc. logs that hints at what the problem is (there
were some fastcgi entries in httpd's error log - 'fastcgi incomplete
headers' and 'unable to access log file' (I've ensured they're
writable).

I can access the Rails models through script/console, so I'm pretty sure
my database.yml is correct.

For trying to get this to work with httpd, I followed these
instructions:
http://wiki.rubyonrails.com/rails/pages/FastCGI
But getting up and running with mongrel and webrick should be dead
simple. I've read that SELinux - which I know next to nothing about -
might be causing problems, but I don't see any related messages. And it
appears to be set to 'permissive' and I 'setenforce 0' just for good
measure.

Can anybody take a guess at what the problem is, before I feel totally
0wn3d?

Thanks!
Joe
Ben R. (Guest)
on 2006-03-07 00:12
(Received via mailing list)
Hi Joe ~

First off, take a deep breath or you will be 0wn3d.  I would highly
recommend trying to get one configuration to work and not jumping
between
them.  I did that for a while and it just makes a mess.  I know the
following to be true:

Rails works great with Lighttpd and thousands of people have gotten it
to
work.  I would focus on getting this configuration to work.

Most times if you are experiencing the issues you describe it is a
database
configuration problem (which you seemed to have ruled out) or a path
issue
in one of your configuration files.  I always recommend going to the
directory you want things to point to and running a pwd to confirm the
path.

If you have light installed (which it sounds like you do), you should be
able to get ./script/server to fire up light instead of webrick (Make
sure
light is in your $PATH!).  This will create a working lighttpd.conf file
for
your app, though you might need to adjust some paths, to get you
started.

I know this isn't much, but stick in there and you'll get it working.

 ~ Ben

PS.  At least your not trying to set it up on Windows ;)  That is where
my
nightmare started.
Joe (Guest)
on 2006-03-07 00:28
Ben R. wrote:
> If you have light installed (which it sounds like you do), you should be
> able to get ./script/server to fire up light instead of webrick (Make
> sure
> light is in your $PATH!).  This will create a working lighttpd.conf file
> for
> your app, though you might need to adjust some paths, to get you
> started.

I didn't know that could be done - learned something new! I always
assumed script/server = webrick.

> PS.  At least your not trying to set it up on Windows ;)  That is where
> my nightmare started.

Heh, I tried to fix it a la Windows and reboot, and now the server's not
coming back online. Got some time while the NOC figures it out.

I'm at a loss why it doesn't work. The same Rails apps are working fine
on my old server. I transferred them to the new server via 'svn co'.
Ruby was installed in /usr/local/bin but I created a symbolic link to it
in /usr/bin, and it seems to work fine. I did 'strace ruby -w
public/dispatch.rb' and it looks like it might be getting hung up trying
to find some 'items_api.rb' file (which I never had in my app). I dunno.

Joe
Steve K. (Guest)
on 2006-03-07 00:31
Sorry if this seems too obvious, but you've said ruby script/console
works but haven't said how you tried to run WEBrick.

What happens when you run script/server from the commandline?

If that's working, you probably have a permissions or some other sort of
fundamental configuration problem. If script/console works but
script/server doesn't.. um...

Joe wrote:
> I got a brand new Fedora Core 4 box and was all excited to get Rails
> running on it. That was about two days ago. I did all the 'yum install
> ruby, etc. etc. etc.', then 'gem install rails, etc. etc. etc'. I've
> tried running Rails with httpd (fastcgi and cgi), lighttpd (scgi,
> fastcgi, cgi), mongrel, webrick, and even 'ruby
> public/dispatch.cgi|fcgi|rb' and NONE of them work; they all display
> '500: internal server error' or 'Rails application failed to start
> properly'.
>
> 'ruby -w public/dispatch.fcgi|cgi|rb' displays a ton of warnings (things
> like 'ambiguous first argument', 'method redefined', 'instance variable
> not initialized', etc., but no errors that appear to be show-stoppers).
> And that's about it - there is NOTHING helpful in any of httpd's,
> lighty's, Rails', etc. logs that hints at what the problem is (there
> were some fastcgi entries in httpd's error log - 'fastcgi incomplete
> headers' and 'unable to access log file' (I've ensured they're
> writable).
>
> I can access the Rails models through script/console, so I'm pretty sure
> my database.yml is correct.
>
> For trying to get this to work with httpd, I followed these
> instructions:
> http://wiki.rubyonrails.com/rails/pages/FastCGI
> But getting up and running with mongrel and webrick should be dead
> simple. I've read that SELinux - which I know next to nothing about -
> might be causing problems, but I don't see any related messages. And it
> appears to be set to 'permissive' and I 'setenforce 0' just for good
> measure.
>
> Can anybody take a guess at what the problem is, before I feel totally
> 0wn3d?
>
> Thanks!
> Joe
Joe (Guest)
on 2006-03-07 00:36
Steve K. wrote:
> Sorry if this seems too obvious, but you've said ruby script/console
> works but haven't said how you tried to run WEBrick.
>
> What happens when you run script/server from the commandline?
>
> If that's working, you probably have a permissions or some other sort of
> fundamental configuration problem. If script/console works but
> script/server doesn't.. um...

Yep, './script/server' (and mongrel) appeared to start fine. Accessing
it via mydomain:3000 displays a '500 internal server' error. WEBrick
displays a '500 0' line in its log too.

Oh yeah, one other thing, I can access static content fine - images,
text files, etc. - via all servers (lighty, httpd, webrick, mongrel),
just nothing Rails.

Joe
Łukasz Piestrzeniewicz (Guest)
on 2006-03-07 00:46
(Received via mailing list)
On 06/03/06, Joe <removed_email_address@domain.invalid> wrote:
> Yep, './script/server' (and mongrel) appeared to start fine. Accessing
> it via mydomain:3000 displays a '500 internal server' error. WEBrick
> displays a '500 0' line in its log too.
>
> Oh yeah, one other thing, I can access static content fine - images,
> text files, etc. - via all servers (lighty, httpd, webrick, mongrel),
> just nothing Rails.

Stupid question, but... Is your database configuration set-up properly?
Joe (Guest)
on 2006-03-07 00:51
Łukasz Piestrzeniewicz wrote:
> On 06/03/06, Joe <removed_email_address@domain.invalid> wrote:
>> Yep, './script/server' (and mongrel) appeared to start fine. Accessing
>> it via mydomain:3000 displays a '500 internal server' error. WEBrick
>> displays a '500 0' line in its log too.
>>
>> Oh yeah, one other thing, I can access static content fine - images,
>> text files, etc. - via all servers (lighty, httpd, webrick, mongrel),
>> just nothing Rails.
>
> Stupid question, but... Is your database configuration set-up properly?

AFAICT. I can access it via psql, script/console, and phppgadmin. I
thought it might be a problem with 'accept tcp connections', which
Postgresql used to have turned off and from which I've been bitten in
the past. But I guess that option has been merged with the
cantrememberwhatitscalled_connections = 'localhost' option. Anyhow,
since I presume since I can access models via script/console,
database.yml must be correct. Unless Rails connects differently via web
servers?

Joe
HH (Guest)
on 2006-03-07 03:02
(Received via mailing list)
One thing that has bitten me: when I forget to grab a gem I need (or
some
other included software).

If your app uses a special gem or plugin in a view or controller and it
isn't present, I can see Rails just dying (and in my experience there is
no
meaningful error message, just death).
Joe (Guest)
on 2006-03-07 03:20
Yeah, it does seem like I've installed a slew of gems. I tried this (now
that my server is back up!):

mkdir /var/www/rtest
cd /var/www/rtest
rails .
./script/generate controller wtf iswrong
./script/server -p 3001 -d
wget http://localhost:3001/wtf/iswrong

And it worked! But 'ruby public/dispatch.rb' gives a '500 internal
server error'.

One of my existing Rails apps (also gotten via 'svn co') is really
simple and doesn't use any additional gems, but that doesn't work
either. I wonder if it's something infuriatingly stupid like DOS/Unix
format config files or something.

Joe
Joe (Guest)
on 2006-03-07 03:30
Hmm, I added some database stuff to wtf#iswrong:

<% Item.find_all.each |item| %>
<%= item.name %>
<% end %>

and that causes 'wget http://localhost:3001/wtf/iswrong' to return a 500
error. So it's gotta be a database access issue. But I don't know why
models work in script/console.

Joe
HH (Guest)
on 2006-03-07 04:23
(Received via mailing list)
Well, are you sure the script/console and through the Web server are
both
hitting the same environment, i.e. Development vs. production?
Tom M. (Guest)
on 2006-03-07 05:09
(Received via mailing list)
Can you access the DB via

script/console production

?

-- -- Tom M.
Tom M. (Guest)
on 2006-03-07 05:09
(Received via mailing list)
Weirdly, it seems when running public/dispatch.fcgi

> 500 internal server error

is actually a success.

The problem is that FCGI is expecting the request
to be piped in on STDIN, which it's not getting
when you run it by hand.

Running public/dispatch.fcgi *is* useful because
you'll get all sorts of useful info when things
are broken. :-)

-- -- Tom M.
Joe (Guest)
on 2006-03-07 05:20
I got the simple site working - turns out it was a missing template that
hadn't been added to svn on the old server. Haven't figured out why the
more complex sites aren't working yet.

Joe
This topic is locked and can not be replied to.