- 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