• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

UltraMonkey-L7 V3(multi-thread implementation)


Commit MetaInfo

Revisionf06409a5544364bb511524dd65a19cc7179f3cdb (tree)
Time2013-03-14 16:43:07
AuthorHiroaki Nakano <nakano.hiroaki@nttc...>
CommiterHiroaki Nakano

Log Message

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>

Change Summary

Incremental Difference

--- a/l7vsd/include/virtualservice.h
+++ b/l7vsd/include/virtualservice.h
@@ -451,6 +451,8 @@ protected:
451451 session_map_type active_sessions;
452452 l7vs::atomic<unsigned long long>
453453 active_count;
454+ session_thread_control *waiting_stc;
455+ //! session_thread_control waiting accept
454456
455457 bool defer_accept_opt;
456458 //! is set option TCP_DEFER_ACCEPT
--- a/l7vsd/src/virtualservice_tcp.cpp
+++ b/l7vsd/src/virtualservice_tcp.cpp
@@ -432,6 +432,7 @@ void l7vs::virtualservice_tcp::handle_accept(const l7vs::session_thread_control
432432 stc_ptr_noconst->session_access_log_output_mode_change(access_log_flag);
433433
434434 active_sessions.insert(tmp_session, stc_ptr_noconst);
435+ waiting_stc = NULL;
435436
436437 //check sorry flag and status
437438 if (unlikely(
@@ -502,6 +503,7 @@ void l7vs::virtualservice_tcp::handle_accept(const l7vs::session_thread_control
502503 boost::mutex::scoped_lock down_wait_lk(stc_ptr_register_accept->get_downthread_mutex());
503504
504505 waiting_session = stc_ptr_register_accept->get_session().get();
506+ waiting_stc = stc_ptr_register_accept;
505507
506508 if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) {
507509 boost::format fmt1("active session thread id = %d");
@@ -914,7 +916,7 @@ void l7vs::virtualservice_tcp::finalize(l7vs::error_code &err)
914916 delete stc;
915917 stc = NULL;
916918 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");
918920 fmt % pool_sessions.size();
919921 Logger::putLogDebug(LOG_CAT_L7VSD_VIRTUALSERVICE, 55, fmt.str(),
920922 __FILE__, __LINE__);
@@ -924,6 +926,9 @@ void l7vs::virtualservice_tcp::finalize(l7vs::error_code &err)
924926 delete waiting_session;
925927 waiting_session = NULL;
926928
929+ //waiting thread delete
930+ waiting_stc->join();
931+
927932 //unload ProtocolModule
928933 if (protomod) {
929934 //finalize ProtocolModule
@@ -1591,6 +1596,7 @@ void l7vs::virtualservice_tcp::run()
15911596 } while (!stc_ptr);
15921597
15931598 waiting_session = stc_ptr->get_session().get();
1599+ waiting_stc = stc_ptr;
15941600
15951601 if (!ssl_virtualservice_mode_flag) {
15961602 acceptor_->async_accept(waiting_session->get_client_socket().get_socket(),