# My Rails app "freezes" everytime I log out from SSH

**URL:** <https://www.ruby-forum.com/t/my-rails-app-freezes-everytime-i-log-out-from-ssh/54955>\
**Category:** Rails\
**Created:** [March 15, 2006, 2:34pm UTC](https://www.ruby-forum.com/t/my-rails-app-freezes-everytime-i-log-out-from-ssh/54955 "2006-03-15T14:34:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kris\_Khaira](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/d6d6ee/32.png) [@Kris\_Khaira](https://www.ruby-forum.com/u/Kris_Khaira)\
**Post date:** [March 15, 2006, 2:34pm UTC](https://www.ruby-forum.com/t/my-rails-app-freezes-everytime-i-log-out-from-ssh/54955/1 "2006-03-15T14:34:54Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![Kris\_Khaira](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/d6d6ee/32.png) [@Kris\_Khaira](https://www.ruby-forum.com/u/Kris_Khaira)\
**Post date:** [March 15, 2006, 4:05pm UTC](https://www.ruby-forum.com/t/my-rails-app-freezes-everytime-i-log-out-from-ssh/54955/2 "2006-03-15T16:05:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kris\_Khaira](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/d6d6ee/32.png) [@Kris\_Khaira](https://www.ruby-forum.com/u/Kris_Khaira)\
**Post date:** [March 15, 2006, 4:36pm UTC](https://www.ruby-forum.com/t/my-rails-app-freezes-everytime-i-log-out-from-ssh/54955/3 "2006-03-15T16:36:39Z")

</div>

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/](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.

---

<div class="post-metadata">

**Author:** ![Kris\_Khaira](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/d6d6ee/32.png) [@Kris\_Khaira](https://www.ruby-forum.com/u/Kris_Khaira)\
**Post date:** [March 15, 2006, 10:10pm UTC](https://www.ruby-forum.com/t/my-rails-app-freezes-everytime-i-log-out-from-ssh/54955/4 "2006-03-15T22:10:37Z")

</div>

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-"freezes"-everytime-I-log-out-from-SSH-t1284610.html#a3424221](http://www.nabble.com/my-Rails-app-%22freezes%22-everytime-I-log-out-from-SSH-t1284610.html#a3424221)  
Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![Kris\_Khaira](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/d6d6ee/32.png) [@Kris\_Khaira](https://www.ruby-forum.com/u/Kris_Khaira)\
**Post date:** [March 16, 2006, 5:02am UTC](https://www.ruby-forum.com/t/my-rails-app-freezes-everytime-i-log-out-from-ssh/54955/5 "2006-03-16T05:02:24Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![Kris\_Khaira](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/d6d6ee/32.png) [@Kris\_Khaira](https://www.ruby-forum.com/u/Kris_Khaira)\
**Post date:** [March 15, 2006, 10:13pm UTC](https://www.ruby-forum.com/t/my-rails-app-freezes-everytime-i-log-out-from-ssh/54955/6 "2006-03-15T22:13:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kris\_Khaira](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/d6d6ee/32.png) [@Kris\_Khaira](https://www.ruby-forum.com/u/Kris_Khaira)\
**Post date:** [March 16, 2006, 5:14am UTC](https://www.ruby-forum.com/t/my-rails-app-freezes-everytime-i-log-out-from-ssh/54955/7 "2006-03-16T05:14:30Z")

</div>

> 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!
