UltraMonkey-L7 V3(multi-thread implementation)
Revision | f06409a5544364bb511524dd65a19cc7179f3cdb (tree) |
---|---|
Time | 2013-03-14 16:43:07 |
Author | Hiroaki Nakano <nakano.hiroaki@nttc...> |
Commiter | Hiroaki Nakano |
del_virtual_service時にthreadが残る問題のfix
del_virtual_service時にsession thread controllの
upとdownのthreadのうち、accept待ちのthreadが削除されず
に残ってしまう。
VirtualServiceのaddとdelを繰り返すとthreadが増え続けて
しまうため、del_virtual_service時に該当threadを
joinするようにした。
Signed-off-by: Hiroaki Nakano <nakano.hiroaki@nttcom.co.jp>
@@ -451,6 +451,8 @@ protected: | ||
451 | 451 | session_map_type active_sessions; |
452 | 452 | l7vs::atomic<unsigned long long> |
453 | 453 | active_count; |
454 | + session_thread_control *waiting_stc; | |
455 | + //! session_thread_control waiting accept | |
454 | 456 | |
455 | 457 | bool defer_accept_opt; |
456 | 458 | //! is set option TCP_DEFER_ACCEPT |
@@ -432,6 +432,7 @@ void l7vs::virtualservice_tcp::handle_accept(const l7vs::session_thread_control | ||
432 | 432 | stc_ptr_noconst->session_access_log_output_mode_change(access_log_flag); |
433 | 433 | |
434 | 434 | active_sessions.insert(tmp_session, stc_ptr_noconst); |
435 | + waiting_stc = NULL; | |
435 | 436 | |
436 | 437 | //check sorry flag and status |
437 | 438 | if (unlikely( |
@@ -502,6 +503,7 @@ void l7vs::virtualservice_tcp::handle_accept(const l7vs::session_thread_control | ||
502 | 503 | boost::mutex::scoped_lock down_wait_lk(stc_ptr_register_accept->get_downthread_mutex()); |
503 | 504 | |
504 | 505 | waiting_session = stc_ptr_register_accept->get_session().get(); |
506 | + waiting_stc = stc_ptr_register_accept; | |
505 | 507 | |
506 | 508 | if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) { |
507 | 509 | boost::format fmt1("active session thread id = %d"); |
@@ -914,7 +916,7 @@ void l7vs::virtualservice_tcp::finalize(l7vs::error_code &err) | ||
914 | 916 | delete stc; |
915 | 917 | stc = NULL; |
916 | 918 | if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) { |
917 | - boost::format fmt("join pool session: pool_sessions.size = %d"); | |
919 | + boost::format fmt("join pool session: pool_session.size = %d"); | |
918 | 920 | fmt % pool_sessions.size(); |
919 | 921 | Logger::putLogDebug(LOG_CAT_L7VSD_VIRTUALSERVICE, 55, fmt.str(), |
920 | 922 | __FILE__, __LINE__); |
@@ -924,6 +926,9 @@ void l7vs::virtualservice_tcp::finalize(l7vs::error_code &err) | ||
924 | 926 | delete waiting_session; |
925 | 927 | waiting_session = NULL; |
926 | 928 | |
929 | + //waiting thread delete | |
930 | + waiting_stc->join(); | |
931 | + | |
927 | 932 | //unload ProtocolModule |
928 | 933 | if (protomod) { |
929 | 934 | //finalize ProtocolModule |
@@ -1591,6 +1596,7 @@ void l7vs::virtualservice_tcp::run() | ||
1591 | 1596 | } while (!stc_ptr); |
1592 | 1597 | |
1593 | 1598 | waiting_session = stc_ptr->get_session().get(); |
1599 | + waiting_stc = stc_ptr; | |
1594 | 1600 | |
1595 | 1601 | if (!ssl_virtualservice_mode_flag) { |
1596 | 1602 | acceptor_->async_accept(waiting_session->get_client_socket().get_socket(), |