OSDN Git Service

ticket #329
authortakamaru <takamaru@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Fri, 6 Mar 2009 08:20:20 +0000 (08:20 +0000)
committertakamaru <takamaru@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Fri, 6 Mar 2009 08:20:20 +0000 (08:20 +0000)
log rotation error by fd shortage fixed
(maxfd set in l7vs.cf)

git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-shamshel-PT@7463 1ed66053-1c2d-0410-8867-f7571e6e31d3

conf/l7vs.cf
src/l7vsd.cpp

index e495f4f..d9e1ec0 100644 (file)
@@ -168,11 +168,6 @@ sslproxy_server                    = "info"
 sslproxy_session               = "info"
 sslproxy_connection            = "info"
 
-[virtualservice]
-nic_realserver_side                    = "eth0"
-session_thread_pool_size       = 256
-throughput_calc_interval       = 500
-
 #
 # l7vsadm setting
 #
@@ -182,6 +177,19 @@ cmd_count = 10
 con_interval = 1
 con_count = 10
 
+#
+# l7vsd setting
+#
+[l7vsd]
+maxfileno = 65535
+
+#
+# virtualservice setting
+#
+[virtualservice]
+nic_realserver_side                    = "eth0"
+session_thread_pool_size       = 256
+throughput_calc_interval       = 500
 
 #
 # l7vsd replication setting
index f6ed4cf..54fb36a 100644 (file)
@@ -26,6 +26,8 @@
 #include <pthread.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <sys/time.h>
+#include <sys/resource.h>
 #include <boost/shared_ptr.hpp>
 
 #include "l7vsd.h"
@@ -836,6 +838,26 @@ int        l7vsd::run( int argc, char* argv[] ) {
                        }
                }
 
+               //set max file open num
+               Parameter       param;
+               error_code      err;
+               int     maxfileno = param.get_int(PARAM_COMP_L7VSD, "maxfileno", err);
+               if( err ){
+                       logger.putLogWarn( LOG_CAT_L7VSD_MAINTHREAD, 1, "maxfileno parameter not found.", __FILE__, __LINE__ );
+                       maxfileno = 1024;
+               }
+
+               struct rlimit lim;
+               lim.rlim_cur = maxfileno;
+               lim.rlim_max = maxfileno;
+               int ret;
+               ret = setrlimit( RLIMIT_NOFILE, &lim );
+               if( 0 != ret ){
+                       std::stringstream buf;
+                       buf << "setrlimit failed:" << errno;
+                       logger.putLogWarn( LOG_CAT_L7VSD_MAINTHREAD, 1, buf.str(), __FILE__, __LINE__ );
+               }
+
                // signal handler thread start
                boost::thread   sigthread( boost::bind( &l7vsd::sig_exit_handler, this ) );
                sigthread.detach();