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

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > 500 error when executing lots of sqls.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-17-2006, 06:38 AM
dlhhyct dlhhyct is offline
Member
 
Join Date: Aug 2006
Posts: 41
Default 500 error when executing lots of sqls.

  • under lsws and ruby lsapi, I often get "The size of dynamic response header is over the limit." warning msg when page or controller method contains large amount of sql calls. lsws aborts the request, and lsws returns 500 server error in browser.
  • although all sqls are executed, and controller method completes successfully, browser just returns 500 error anyway.
  • In admin GUI, After I change tuning/Max Dynamic Response Header Size (bytes) to 8192, instead of 500 error, browser ask me to download the page, I guess for debugging purpose, file (1-2 kb) I download starts with one sql statement and follows with binary stuff. Download only happens in rails development mode, production mode always returns 500 error regardless header size.
  • Same code works under webrick.
  • I know header size is for security/ddos reasons, why does it go off when I do lots of sqls?

how do I avoid this error when I have to do lots of sql calls?

test code below, try raise or lower the number to see different behaviors.
Code:
class TestController < ApplicationController
  def index
    70.times{|i|   
      begin
        logger.info(i)
        user = User.find(i)
      rescue Exception => err   # rails throw err if no user found
        logger.error(err)
      end
    }
  end
end
Reply With Quote
  #2  
Old 09-17-2006, 06:53 AM
dlhhyct dlhhyct is offline
Member
 
Join Date: Aug 2006
Posts: 41
Default hold on

spoke too soon, I create a whole new app, and was unable to reproduce 500 error, i guess cause is somewhere else in my current app.

please disregard my previous post.
Reply With Quote
  #3  
Old 09-17-2006, 07:24 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
Maybe your rails app uses a lot of memory for those SQL, try increasing the "memory limit" under "Rails" tab, see if it helps or not.

You should be able to find some clues for this problem in lsws/logs/stderr.log, lsws/logs/error.log as well as Rails' log files.
Reply With Quote
  #4  
Old 09-17-2006, 09:04 AM
dlhhyct dlhhyct is offline
Member
 
Join Date: Aug 2006
Posts: 41
Default solved

in my code, i had lots of puts statements to debug, and i even overwrite logger.debug in model classes, because debug msg wasn't showing somehow before. after i remove all of these puts. problem went away.

Code:
def logger.debug(msg)
  puts msg
end
I guess when lots of sql is being called, all these puts accumulates and exceed header limit.
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 01:46 PM.



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