Forum: Ruby on Rails my Rails app "freezes" everytime I log out from SSH

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.
Kris Khaira (Guest)
on 2006-03-15 15:34
(Received via mailing list)
Hi there,

I've a Rails app running on one of my shared hosting accounts.
Everytime I log out from SSH, my Rails application shows this error
message after 5-10 minutes:

"Application Error (Rails)"

Whenever I log back in to SSH with my account, my site is back to
normal. I've Googled everywhere for days and tried all of these
suggestions:

- make sure it's in production mode
- set the mysql details properly
- tried restarting the server
- tried refreshing the page
- tried clearing my cookies
- cleared temporary session files in /tmp/ (I've even set a cron job
to do this every 5 minutes)

What is wrong? Is there some setting in the server which disables my
WEBrick process whenever I am no longer in an SSH session? It doesn't
really kill my server or ruby process. All it does is "freeze" it.
The moment I log back into SSH, my app goes back online and the error
message disappears. You can view my site here: http://
wildasia.oryzo.com:3000/

If it's online, it probably means I'm on SSH or I've found the
answer. If not, then it probably means I'm not on SSH.

Thank you in advance.

- Kris
Martin S. (Guest)
on 2006-03-15 17:05
Kris Khaira wrote:
> Hi there,
>
> I've a Rails app running on one of my shared hosting accounts.
> Everytime I log out from SSH, my Rails application shows this error
> message after 5-10 minutes:
>
Maybe this is far off, but I had a similar problem when I was using a
desktop mac as a server. When I was not logged in, the server was not
running, although i had started it as a daemon. The problem was that the
mac remounted the user drive everytime I logged in or out. Maybe it is
something similar at your host?
Martin
Guest (Guest)
on 2006-03-15 17:36
Kris Khaira wrote:
> Hi there,
>
> I've a Rails app running on one of my shared hosting accounts.
> Everytime I log out from SSH, my Rails application shows this error
> message after 5-10 minutes:
>
> "Application Error (Rails)"
>
> Whenever I log back in to SSH with my account, my site is back to
> normal. I've Googled everywhere for days and tried all of these
> suggestions:
>
> - make sure it's in production mode
> - set the mysql details properly
> - tried restarting the server
> - tried refreshing the page
> - tried clearing my cookies
> - cleared temporary session files in /tmp/ (I've even set a cron job
> to do this every 5 minutes)
>
> What is wrong? Is there some setting in the server which disables my
> WEBrick process whenever I am no longer in an SSH session? It doesn't
> really kill my server or ruby process. All it does is "freeze" it.
> The moment I log back into SSH, my app goes back online and the error
> message disappears. You can view my site here: http://
> wildasia.oryzo.com:3000/
>
> If it's online, it probably means I'm on SSH or I've found the
> answer. If not, then it probably means I'm not on SSH.
>
> Thank you in advance.
>
> - Kris

Provide names and version numbers of relevant components when asking for
help--like which OS you're using.

Don't use Webrick for production or testing. It is only for development.
And restart Webrick every hour or two so it doesn't eat up all your RAM.

Try using one of the following setups for testing and production:
1. Apache 2.0.x + mod_fcgid-1.08
2. Lighttpd-1.4.11 + mod_fastcgi
3. Apache 1.3.x + mod_fastcgi-2.4.2

Good luck.
Steve R. (Guest)
on 2006-03-15 23:10
(Received via mailing list)
I may be missing something, but are you detaching the processes that are
serving Rails pages? If you are not doing:

script/lighttpd &

or something like that, the process will die when you log out.

Hope this helps.
--
View this message in context:
http://www.nabble.com/my-Rails-app-%22freezes%22-e...
Sent from the RubyOnRails Users forum at Nabble.com.
David M. (Guest)
on 2006-03-15 23:13
(Received via mailing list)
I think you probably need

nohup script/lighttpd &

if that's the case.  nohup will make sure your process keeps running
after the parent process (i.e. your terminal session) gets killed off.

Regards

Dave M.
Kris Khaira (Guest)
on 2006-03-16 06:02
(Received via mailing list)
> Maybe this is far off, but I had a similar problem when I was using a
> desktop mac as a server. When I was not logged in, the server was not
> running, although i had started it as a daemon. The problem was
> that the
> mac remounted the user drive everytime I logged in or out.

That's funny. I don't think this is a problem because my server's on
FreeBSD. Also, I don't get this problem on my Powerbook, whenever I
keep it online and I use it as a server.
Kris Khaira (Guest)
on 2006-03-16 06:14
(Received via mailing list)
> if that's the case.  nohup will make sure your process keeps running
> after the parent process (i.e. your terminal session) gets killed off.

Darn it. That would be nice, but my host sent me this email last night:

> Please be informed that running WEBrick on your ssh session is not
> recommended as it will be terminated when ssh session is terminated.
> For your information, we do allow running ruby on rails via CGI.

And today it seems WEBrick doesn't work anymore. I think they've
disabled it. I guess they have the right to because they have never
advertised WEBrick support but only FastCGI over Apache. I used
WEBrick instead of Apache-FastCGI because I thought it was faster.

I guess it's time to take "Guest"'s advice:

> 1. Apache 2.0.x + mod_fcgid-1.08
> 2. Lighttpd-1.4.11 + mod_fastcgi
> 3. Apache 1.3.x + mod_fastcgi-2.4.2

Thanks Guest, whoever you are!
This topic is locked and can not be replied to.