LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > 503 error on every initial request to a Rails site

Reply
 
Thread Tools Display Modes
  #1  
Old 05-09-2009, 10:22 AM
amaltemara amaltemara is offline
Member
 
Join Date: Dec 2007
Posts: 29
Exclamation 503 error on every initial request to a Rails site

I keep getting a 503 error the first time I pull a page from the rails app... After that, the subsequent requests pull fine with no errors..

I'm running Litespeed Web Server Enterprise: v4.0.2
Rails version: 2.2.2
ruby-lsapi gem version: 3.4


I suspect it's something to do with timeouts, and I've tried to adjust those values, and I'm not getting different results...

There is nothing in the lsws error log for that app, there's nothing in the rails logs...

The main error log file shows this (nothing unusual as far as I know):
2009-05-09 13:12:35.459 [INFO] [Rails:myrailsapp.com:/] add child process pid: 11789
2009-05-09 13:12:35.459 [INFO] [Rails:myrailsapp.com:/] pid list size: 1
2009-05-09 13:12:35.468 [INFO] [Rails:myrailsapp.com:/] add child process pid: 11790
2009-05-09 13:12:35.468 [INFO] [Rails:myrailsapp.com:/] pid list size: 1
2009-05-09 13:12:35.488 [INFO] [forms.myrailsapp-RailsLSAPI] add child process pid: 11791
2009-05-09 13:12:35.488 [INFO] [myrailsapp.com-RailsLSAPI] pid list size: 1



I have this site set up as a Virtual Host, Rails is set up as an External App, LSAPI, with these settings:
Max Connections: 10
Environment: RAILS_ENV=production LSAPI_CHILDREN=10
Initial Request Timeout: 30
Retry Timeout: 30
Persistent Connection: Yes
Connection Keepalive Timeout: 20
Response Buffering: No
Auto Start: Yes
Instances: 2
Run On Start Up: Yes


Under Context: Rails, configuration:
Max Connections: 20




Anyone know what I'm doing wrong??? I need this app to be rock-solid, and not give any errors like this...

TIA

-Anthony
Reply With Quote
  #2  
Old 05-09-2009, 10:23 PM
auser auser is offline
Senior Member
 
Join Date: Mar 2009
Posts: 119
since it's first request to get 503 error, can you try increasing
Initial Request Timeout: 30

also wonder if
Instances: 2
can change to 1
or equal to
Max Connections: 10
Reply With Quote
  #3  
Old 05-09-2009, 11:37 PM
pguy pguy is offline
Member
 
Join Date: Jul 2007
Posts: 28
Even we've faced tons of 503 issues - but there is just no clear solution and we still face it intermittently. If it continues, we may have to leave litespeed and go to passenger/apache combo
Reply With Quote
  #4  
Old 05-10-2009, 05:14 AM
amaltemara amaltemara is offline
Member
 
Join Date: Dec 2007
Posts: 29
Default a way to troubleshoot this???

Quote:
Originally Posted by pguy View Post
Even we've faced tons of 503 issues - but there is just no clear solution and we still face it intermittently. If it continues, we may have to leave litespeed and go to passenger/apache combo

Surely there's a way to troubleshoot exactly where the 503 is coming from???

When there's an error in the Rails application, and I get a 503, I know it's the rails app because I execute:
# RAILS_ENV=production script/console
from the command line, and I get whatever nasty bug that pops up...

Is there a way for me to get an email notification on these 503 errors, and why they occur? Or see it in some logfile? I'm not seeing them in the logs right now...
Reply With Quote
  #5  
Old 05-10-2009, 05:26 AM
amaltemara amaltemara is offline
Member
 
Join Date: Dec 2007
Posts: 29
Question but what does it mean??

Quote:
Originally Posted by auser View Post
since it's first request to get 503 error, can you try increasing
Initial Request Timeout: 30

also wonder if
Instances: 2
can change to 1
or equal to
Max Connections: 10

You have a good point, but honestly, I'm not sure if the Instances parameter would help with the initial startup... (I do have 'Auto Start: 1')

So, I'm less inclined to try changing those values any more until I understand how they affect the process...

Any litespeed gurus that can help shed some "light" on how these variables affect startup speed?
Reply With Quote
  #6  
Old 05-13-2009, 06:13 PM
amaltemara amaltemara is offline
Member
 
Join Date: Dec 2007
Posts: 29
Question ???? nobody has ideas on how to troubleshoot ???

I'm a bit at a loss... I've had to resort to a cron job every 2 mins to pull a page, just to ensure it's up...

I have the max time set to -1, and Auto Start: Yes, so I shouldn't have to do this...

Anyone have any clues on how to troubleshoot this 503 error??
Reply With Quote
  #7  
Old 05-13-2009, 06:15 PM
amaltemara amaltemara is offline
Member
 
Join Date: Dec 2007
Posts: 29
oh, and I did increase the Timeout to 60 seconds... still got the exact same symptoms...

I timed how long it took the rails app to come up with RAILS_ENV=production script/console , and it tool about 29seconds... So 60 should be plenty!???
Reply With Quote
  #8  
Old 05-13-2009, 08:15 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Yes, you should set "Instances" to "1".
Also try adding environment variable

LSAPI_PGRP_MAX_IDLE=86400

The ruby process should be started when LSWS start and stay alive. so the slow start should be avoided.
Reply With Quote
  #9  
Old 05-18-2009, 08:19 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
please download the 4.0.4 release package and give it try. It should not give 503 errors when LSWS need to start a Rails application on demand.
Just change the version number in the download link to get it.
Reply With Quote
  #10  
Old 05-24-2009, 07:05 PM
amaltemara amaltemara is offline
Member
 
Join Date: Dec 2007
Posts: 29
Smile lsws 4.0.4 fixed it, thanks!

Quote:
Originally Posted by mistwang View Post
please download the 4.0.4 release package and give it try. It should not give 503 errors when LSWS need to start a Rails application on demand.
Just change the version number in the download link to get it.
Thanks, lsws 4.0.4 doesn't give me the 503, thanks...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:16 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.