Project

General

Profile

バグ #3658

ExecutionContextWorker::removeComponent関数で動作が停止する問題

Added by n-miyamoto over 4 years ago. Updated over 3 years ago.

Status:
終了
Priority:
通常
Assignee:
Start date:
10/11/2016
Due date:
% Done:

100%

Estimated time:

Description

ExecutionContextWorker::removeComponent関数の以下の部分でミューテックスm_removedMutexでロックをするが、このロックを解放せずにupdateComponentList関数で再度ロックしようとするため身動きがとれなくなることがある。

Guard removeGuard(m_removedMutex);
 m_removedComps.push_back(rtobj);
Guard guard(m_mutex);
if (!m_running) { updateComponentList(); }

Associated revisions

Revision 2780 (diff)
Added by n-ando over 4 years ago

[compat,bugfix,->RELENG_1_2] Potential deadlock mutexes are now put into limited scopes. refs #3658

Revision 2780 (diff)
Added by n-ando over 4 years ago

[compat,bugfix,->RELENG_1_2] Potential deadlock mutexes are now put into limited scopes. refs #3658

History

#1 Updated by n-ando over 4 years ago

  • Assignee set to miyamoto
  • Target version set to RELENG_1_2
  • % Done changed from 0 to 90

mutexロックにスコープを追加

===================================================================
--- ExecutionContextWorker.cpp  (リビジョン 2778)
+++ ExecutionContextWorker.cpp  (作業コピー)
@@ -143,7 +143,7 @@
    * @brief Changing execution rate of the ExecutionContext
    * @endif
    */
-  RTC::ReturnCode_t ExecutionContextWorker::rateChanged(void)
+  RTC::ReturnCode_t ExecutionContextWorker::rateChanged()
   {
     RTC_TRACE(("rateChanged()"));
     // invoke on_shutdown for each comps.
@@ -367,12 +367,15 @@
         RTC_ERROR(("no RTC found in this context."));
         return  RTC::BAD_PARAMETER;
       }
-    Guard removeGuard(m_removedMutex);
-    m_removedComps.push_back(rtobj);
-
+    {
+      Guard removeGuard(m_removedMutex);
+      m_removedComps.push_back(rtobj);
+    }
     // if EC is stopping, update component list immediately.
-    Guard guard(m_mutex);
-    if (!m_running) { updateComponentList(); }
+    {
+      Guard guard(m_mutex);
+      if (!m_running) { updateComponentList(); }
+    }

     return RTC::RTC_OK;
   }

再テストおねがいします。>宮本君

#2 Updated by n-miyamoto about 4 years ago

  • Status changed from 新規 to 解決
  • % Done changed from 90 to 100

PeriodicExecutionContextTestsのtest_removeComponent関数で正常に動作することを確認

#3 Updated by n-ando over 3 years ago

  • Status changed from 解決 to 終了

Also available in: Atom PDF