Having issues after upgrade to LSWS 4.0.3 and Rails 2.3.2.1

Discussion in 'Ruby/Rails' started by malffred, May 15, 2009.

  1. malffred

    malffred New Member

    Hey guys,

    Hopefully you can help me out a bit on this, I might just have a problem with my config.

    The situation is this:

    1. Upgraded app to Rails 2.3.2.1 from 2.1.1
    2. Upgraded LSWS to 4.0.3 from 3.3.23 (whatever the last release was for the version 3 branch)
    3. We have a staging server where the app worked fine in 2.1.1
    4. The app in 2.3.2.1 works fine on our dev boxes (running mongrel)
    5. When we deploy to our staging server, it startups up an lsapi process for a few seconds but then it goes away and we get a 503 Service Unavailable error

    Looking at the LSWS logs, I see this error happening upon the requests:

    Code:
    2009-05-14 14:16:59.518 [NOTICE] Loading LiteSpeed/4.0.3 Standard ...
    2009-05-14 14:16:59.721 [NOTICE] [ADMIN] server socket: uds://opt/lsws/admin/tmp/admin.sock.7248
    2009-05-14 14:16:59.722 [NOTICE] Loading configuration from /opt/lsws/conf/httpd_config.xml ...
    2009-05-14 14:16:59.723 [NOTICE] Recovering server socket: [*:80]
    2009-05-14 14:16:59.723 [NOTICE] Recovering server socket: [*:443]
    2009-05-14 14:16:59.723 [NOTICE] Recovering server socket: [*:81]
    2009-05-14 14:16:59.723 [INFO] old priority: -15, new priority: -15
    2009-05-14 14:16:59.723 [INFO] [config:server:basic] For better obscurity, server version number is hidden in the response header.
    2009-05-14 14:16:59.730 [NOTICE] The maximum number of file descriptor limit is set to 1024.
    2009-05-14 14:16:59.733 [NOTICE] lshttpd (20576) is ready
    2009-05-14 14:16:59.735 [NOTICE] [child: 20578] Successfully change current user to nobody
    2009-05-14 14:16:59.735 [NOTICE] [Child: 20578] Core dump is enabled.
    2009-05-14 14:16:59.736 [INFO] [staging] add child process pid: 20579
    2009-05-14 14:16:59.736 [INFO] [staging] pid list size: 1 
    2009-05-14 14:16:59.736 [NOTICE] [Child: 20578] Setup swapping space...
    2009-05-14 14:16:59.736 [NOTICE] [Child: 20578] LiteSpeed/4.0.3 Standard starts successfully!
    2009-05-14 14:16:59.736 [NOTICE] [AutoRestarter] new child process with pid=20578 is forked!
    2009-05-14 14:17:00.111 [NOTICE] [AutoUpdate] Checking for new releases...
    2009-05-14 14:17:00.276 [INFO] [AutoUpdate] No new update.
    2009-05-14 14:17:20.593 [INFO] Remove pid: 20579
    2009-05-14 14:17:20.593 [INFO] Pid: 20579 associated with [staging]
    2009-05-14 14:17:20.593 [INFO] [staging] pid list size: 0, pid stop list size: 0
    2009-05-14 14:17:28.577 [INFO] [75.25.130.134:56746-0#dev.sugarstats.com] File not found [/home/sugardev/www/releases/20090514135308/public/index.html] 
    2009-05-14 14:17:28.578 [INFO] [staging] add child process pid: 20605
    2009-05-14 14:17:28.578 [INFO] [staging] pid list size: 1 
    2009-05-14 14:17:33.070 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] No request delivery notification has been received from LSAPI process:-2, possible run away process.
    2009-05-14 14:17:33.070 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] Retry with new process group.
    2009-05-14 14:17:38.070 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] No request delivery notification has been received from LSAPI process:-2, possible run away process.
    2009-05-14 14:17:38.070 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] Retry with new process group.
    2009-05-14 14:17:43.069 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] No request delivery notification has been received from LSAPI process:-2, possible run away process.
    2009-05-14 14:17:43.069 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] Retry with new process group.
    2009-05-14 14:17:48.066 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] No request delivery notification has been received from LSAPI process:-2, possible run away process.
    2009-05-14 14:17:48.066 [INFO] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] connection to [uds://tmp/lshttpd/staging.sock] on request #0, confirmed: 0, Connection timed out!
    2009-05-14 14:17:48.066 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] Suspious request timeout, associtated process: -1, running: 0.
    2009-05-14 14:17:48.066 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] Max retries has been reached, 503!
    2009-05-14 14:17:48.066 [INFO] Remove pid: 20605
    2009-05-14 14:17:48.066 [INFO] Pid: 20605 associated with [staging]
    2009-05-14 14:17:48.066 [INFO] [staging] pid list size: 0, pid stop list size: 0
    2009-05-14 14:17:48.067 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] oops! 503 Service Unavailable
    2009-05-14 14:17:48.067 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] Content len: 0, Request line: 
    (null)
    2009-05-14 14:17:48.067 [NOTICE] [75.25.130.134:56746-0#dev.sugarstats.com:lsapi] Redirect: #2, URL: /dispatch.lsapi
    
    
    As you can see I get the "possible run away process." message several times before the 503 is served for max retry limit.

    We are using the dispatch.lsapi as this is our "staging" environment and no production (though it is supposed to duplicate production). Perhaps that is old practice to use that and it is no longer needed?

    Any suggestion on how I can fix this problem? Thanks.
  2. mistwang

    mistwang LiteSpeed Staff

    The log shows that the RailsRunner.rb failed to start. You should check other Rails 2.3.x discussion.
    I think your RailsRunner.rb need to be updated with the one coming from 4.0.3 release to get Rails 2.3.x support.
  3. malffred

    malffred New Member

    Oh ok, so is RailsRunner coming from ruby-lsapi? I was running 3.3, I just updated the gem to 3.5. I restarted LSWS but it didn't seem to make a diff.

    On our staging capistrano deploy script we have this custom after_update_code method run:

    Code:
    namespace :deploy do 
      task :after_update_code, :roles => :app do
        sudo <<-CMD
        sh -c "chown -R #{jail_user}:#{jail_group} #{release_path} &&
               chmod -R g+w #{release_path}"
        CMD
      
        # Put the dispatch.lsapi into the application (just required for staging).
        if rails_env == "staging"
          sudo "cp /usr/lib/ruby/gems/1.8/gems/ruby-lsapi-3.5/rails/dispatch.lsapi #{release_path}/public/dispatch.lsapi"
          sudo "chmod +x #{release_path}/public/dispatch.lsapi"
        end
      end
     
      task :restart, :roles => :app do 
        sudo "#{lsws_cmd} restart"
      end 
    end
    
    Or do I have to update other files to get RailsRunning up to date?

    Here is a snippet from the stderr.log file:

    Code:
    2009-05-15 03:59:54.885 [STDERR] /home/sugardev/www/releases/20090515034617/vendor/plugins/active_scaffold/lib/active_scaffold/config/core.rb:145:in `method_missing': undefined method `configure' for #<ActiveScaffold::Config::Core:0x2b6e6ec76ae8> (NoMethodError)
    2009-05-15 03:59:55.038 [STDERR] 	from /home/sugardev/www/releases/20090515034617/vendor/plugins/active_scaffold/lib/active_scaffold.rb:57:in `active_scaffold'
    2009-05-15 03:59:55.038 [STDERR] 	from /home/sugardev/www/releases/20090515034617/app/controllers/admin/users_controller.rb:11
    2009-05-15 03:59:55.038 [STDERR] 	from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    2009-05-15 03:59:55.038 [STDERR] 	from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    2009-05-15 03:59:55.038 [STDERR] 	from /home/sugardev/www/releases/20090515034617/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
    2009-05-15 03:59:55.038 [STDERR] 	from /home/sugardev/www/releases/20090515034617/vendor/rails/activesupport/lib/active_support/dependencies.rb:265:in `require_or_load'
    2009-05-15 03:59:55.038 [STDERR] 	from /home/sugardev/www/releases/20090515034617/vendor/rails/activesupport/lib/active_support/dependencies.rb:224:in `depend_on'
    2009-05-15 03:59:55.038 [STDERR] 	from /home/sugardev/www/releases/20090515034617/vendor/rails/activesupport/lib/active_support/dependencies.rb:136:in `require_dependency'
    2009-05-15 03:59:55.038 [STDERR] 	 ... 7 levels...
    2009-05-15 03:59:55.038 [STDERR] 	from /home/sugardev/www/current/public/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
    2009-05-15 03:59:55.038 [STDERR] 	from /home/sugardev/www/current/public/../config/environment.rb:13
    2009-05-15 03:59:55.038 [STDERR] 	from /home/sugardev/www/current/public/dispatch.lsapi:7:in `require'
    2009-05-15 03:59:55.038 [STDERR] 	from /home/sugardev/www/current/public/dispatch.lsapi:7
    2009-05-15 04:00:25.300 [STDERR] /home/sugardev/www/releases/20090515034617/vendor/plugins/active_scaffold/lib/active_scaffold/config/core.rb:145:in `method_missing': undefined method `configure' for #<ActiveScaffold::Config::Core:0x2b7aeb565c98> (NoMethodError)
    2009-05-15 04:00:25.536 [STDERR] 	from /home/sugardev/www/releases/20090515034617/vendor/plugins/active_scaffold/lib/active_scaffold.rb:57:in `active_scaffold'
    2009-05-15 04:00:25.536 [STDERR] 	from /home/sugardev/www/releases/20090515034617/app/controllers/admin/users_controller.rb:11
    	from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    	from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    	from /home/sugardev/www/releases/20090515034617/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
    	from /home/sugardev/www/releases/20090515034617/vendor/rails/activesupport/lib/active_support/dependencies.rb:265:in `require_or_load'
    2009-05-15 04:00:25.536 [STDERR] 	from /home/sugardev/www/releases/20090515034617/vendor/rails/activesupport/lib/active_support/dependencies.rb:224:in `depend_on'
    	from /home/sugardev/www/releases/20090515034617/vendor/rails/activesupport/lib/active_support/dependencies.rb:136:in `require_dependency'
    	 ... 7 levels...
    2009-05-15 04:00:25.536 [STDERR] 	from /home/sugardev/www/current/public/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
    	from /home/sugardev/www/current/public/../config/environment.rb:13
    2009-05-15 04:00:25.537 [STDERR] 	from /home/sugardev/www/current/public/dispatch.lsapi:7:in `require'
    	from /home/sugardev/www/current/public/dispatch.lsapi:7
    
    Perhaps it's a gem issue or conflict? Again, this is only happening under LSWS, works fine on mongrel. Thanks for the help.
  4. mistwang

    mistwang LiteSpeed Staff

    If you use "Rails" Context, it will be using lsws/fcgi-bin/RailsRunner.rb ,
    The dispatch.lsapi wont work with Rails 2.3.x .
  5. malffred

    malffred New Member

    Oh ok, yeah the context now uses "/dispatch.lsapi". I'll switch it to use RailsRunner.rb and see if that works.
  6. malffred

    malffred New Member

    I've been playing around with all sorts of context, external app and virtual host setting with no success.

    I think I'm just going to delete the vhost completely redo it from scratch.

    So my question is, are there any tutorials that you know of which show how to setup LSWS under a different environment name?

    If I follow this tutuorial: http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:ruby_rails_easy What would I have to do different in order to make it work under the environment name "staging".

    Other than the environment name, it's going to be identical to a typical production Rails 2.3 app install.

    Thanks
  7. mistwang

    mistwang LiteSpeed Staff

    just select "staging".
  8. malffred

    malffred New Member

    Sorry to bother, I guess this is my last ditch effort to try and get this working.

    I've done the following:

    1. Completely deleted and re-installed LSWS at 4.0.3
    2. Completely re-installed the virtual host, based off the EasyRubyonRails Template
    3. Set the server to run under the staging environment
    4. Have done several complete server restarts
    5. Have tried the standard /opt/lsws/fcgi-bin/RailsRunner.rb
    6. Have renamed RailsRunner.rb.2.3 to RailsRunner.rb and tried that

    Yet I still get 503 Service Unavailable errors. I've turned debug logging to high, here is what happens after a fresh restart and I try to access the domain from the browser:

    Code:
    2009-05-16 04:09:39.279 [NOTICE] Loading LiteSpeed/4.0.3 Standard ...
    2009-05-16 04:09:39.280 [DEBUG] Daemonized!
    2009-05-16 04:09:39.490 [NOTICE] [ADMIN] server socket: uds://opt/lsws/admin/tmp/admin.sock.7768
    2009-05-16 04:09:39.490 [NOTICE] Loading configuration from /opt/lsws/conf/httpd_config.xml ...
    2009-05-16 04:09:39.491 [NOTICE] Recovering server socket: [*:80]
    2009-05-16 04:09:39.491 [NOTICE] Recovering server socket: [*:443]
    2009-05-16 04:09:39.492 [NOTICE] Recovering server socket: [*:81]
    2009-05-16 04:09:39.492 [INFO] old priority: -19, new priority: -19
    2009-05-16 04:09:39.492 [INFO] [config:server:basic] For better obscurity, server version number is hidden in the response header.
    2009-05-16 04:09:39.499 [NOTICE] The maximum number of file descriptor limit is set to 1024.
    2009-05-16 04:09:39.502 [NOTICE] lshttpd (8562) is ready
    2009-05-16 04:09:39.503 [DEBUG] try to give up super user privilege!
    2009-05-16 04:09:39.503 [NOTICE] [child: 8564] Successfully change current user to nobody
    2009-05-16 04:09:39.503 [NOTICE] [Child: 8564] Core dump is enabled.
    2009-05-16 04:09:39.504 [NOTICE] [AutoRestarter] new child process with pid=8564 is forked!
    2009-05-16 04:09:39.505 [INFO] [Rails:dev.sugarstats.com:/] add child process pid: 8565
    2009-05-16 04:09:39.505 [INFO] [Rails:dev.sugarstats.com:/] pid list size: 1 
    2009-05-16 04:09:39.505 [NOTICE] [Child: 8564] Setup swapping space...
    2009-05-16 04:09:39.505 [NOTICE] [Child: 8564] LiteSpeed/4.0.3 Standard starts successfully!
    2009-05-16 04:09:40.124 [NOTICE] [AutoUpdate] Checking for new releases...
    2009-05-16 04:09:40.300 [INFO] [AutoUpdate] No new update.
    2009-05-16 04:09:41.980 [INFO] [AdminPHP] pid list size: 1 
    2009-05-16 04:09:41.980 [INFO] [AdminPHP] add child process pid: 8567
    2009-05-16 04:09:59.826 [INFO] Remove pid: 8565
    2009-05-16 04:09:59.826 [INFO] Pid: 8565 associated with [Rails:dev.sugarstats.com:/]
    2009-05-16 04:09:59.826 [INFO] [Rails:dev.sugarstats.com:/] pid list size: 0, pid stop list size: 0
    2009-05-16 04:09:59.826 [NOTICE] [Rails:dev.sugarstats.com:/] stop worker processes
    2009-05-16 04:09:59.826 [INFO] [Rails:dev.sugarstats.com:/] 1 request being processed, kill external app later.
    2009-05-16 04:09:59.826 [INFO] [75.25.130.134:55537-0#dev.sugarstats.com] connection to [uds://tmp/lshttpd/dev.sugarstats.com:_.sock] on request #0, confirmed: 0, Connection reset by peer!
    2009-05-16 04:09:59.827 [INFO] [Rails:dev.sugarstats.com:/] add child process pid: 8574
    2009-05-16 04:09:59.827 [INFO] [Rails:dev.sugarstats.com:/] pid list size: 1 
    2009-05-16 04:10:04.072 [NOTICE] [75.25.130.134:55537-0#dev.sugarstats.com] No request delivery notification has been received from LSAPI process:-2, possible run away process.
    2009-05-16 04:10:04.072 [NOTICE] [75.25.130.134:55537-0#dev.sugarstats.com] Retry with new process group.
    2009-05-16 04:10:09.035 [NOTICE] [75.25.130.134:55537-0#dev.sugarstats.com] No request delivery notification has been received from LSAPI process:-2, possible run away process.
    2009-05-16 04:10:09.035 [NOTICE] [75.25.130.134:55537-0#dev.sugarstats.com] Retry with new process group.
    2009-05-16 04:10:14.038 [NOTICE] [75.25.130.134:55537-0#dev.sugarstats.com] No request delivery notification has been received from LSAPI process:-2, possible run away process.
    2009-05-16 04:10:14.038 [INFO] [75.25.130.134:55537-0#dev.sugarstats.com] connection to [uds://tmp/lshttpd/dev.sugarstats.com:_.sock] on request #0, confirmed: 0, Connection timed out!
    2009-05-16 04:10:14.038 [NOTICE] [75.25.130.134:55537-0#dev.sugarstats.com] Suspious request timeout, associtated process: -1, running: 0.
    2009-05-16 04:10:14.038 [NOTICE] [75.25.130.134:55537-0#dev.sugarstats.com] Max retries has been reached, 503!
    2009-05-16 04:10:14.038 [NOTICE] [75.25.130.134:55537-0#dev.sugarstats.com] oops! 503 Service Unavailable
    2009-05-16 04:10:14.038 [NOTICE] [75.25.130.134:55537-0#dev.sugarstats.com] Content len: 0, Request line: 
    (null)
    2009-05-16 04:10:14.038 [NOTICE] [75.25.130.134:55537-0#dev.sugarstats.com] Redirect: #2, URL: /dispatch.lsapi
    2009-05-16 04:10:24.680 [INFO] Remove pid: 8574
    2009-05-16 04:10:24.680 [INFO] Pid: 8574 associated with [Rails:dev.sugarstats.com:/]
    2009-05-16 04:10:24.680 [INFO] [Rails:dev.sugarstats.com:/] pid list size: 0, pid stop list size: 0
    
    It says something about lsapi and dispatch.lsapi still but I"m not using that at all? I'm using the RailsRunner, each time I try to access the site I see this process pop-up for a few seconds and then disappear:

    Code:
    sugardev  8534 95.0 10.2 127668 53716 ?        R<   04:07   0:03 ruby /opt/lsws/fcgi-bin/RailsRunner.rb
    
    From reading that, is there anything that might shed some light on why this is happening? Is one of my settings off?
  9. mistwang

    mistwang LiteSpeed Staff

    Looks like your application does not run well with RailsRunner.rb.
    Please try a blank Rails application with Rails 2.3.3 see if it works.
  10. genroxbro

    genroxbro New Member

    Having issues after upgrade to LSWS 4 0 3 and Rails 2 3 2 1

    After some email exchanges with support. It appears that the issue is due to restrictive mysql server settings by site5. We might get a fix from rails in future.

    But I have found that the following workaround worked for me:

    Whenever you get this error, just issue the command
    reload
    in the console and immediately repeat the same command.


    --Amit
    _____________________________________
    Website I designed for payday loans in bc company.
  11. Tarembah73

    Tarembah73 New Member

    Having issues after upgrade to LSWS 4 0 3 and Rails 2 3 2 1

    Hi Rails Experts

    After sending the email from controller using actionmailer with :smtp option, The email is being sent, but, the control is not returning to the next step for render partial action. HTTP 500 error Rails application failed to start properly is being rendered on the page after sending the email.


    I dont see any error messages in the logs too. I made sure the actionmailer logging enabled in production.rb by adding the below line...config.action_mailer.raise_delivery_errors = true.

    Can anyone help me in this regard please?
  12. mistwang

    mistwang LiteSpeed Staff

    It is a Rails internal problem I guess, you can try downgrade rails see if it helps.
    Rails 2.3 has some major changes comparing to Rails 2.2 or earlier release.
  13. johntikolo

    johntikolo New Member

    After some email exchanges with support. It appears that the issue is due to restrictive mysql server settings by site5. We might get a fix from rails in future.

Share This Page