プロジェクト

全般

プロフィール

バグ #3658

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

n-miyamoto7年以上前に追加. 6年以上前に更新.

ステータス:
終了
優先度:
通常
担当者:
対象バージョン:
開始日:
2016/10/11
期日:
進捗率:

100%

予定工数:

説明

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

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

関係しているリビジョン

リビジョン 2780 (差分)
n-ando7年以上前に追加

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

リビジョン 2780 (差分)
n-ando7年以上前に追加

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

履歴

#1 n-ando7年以上前に更新

  • 担当者miyamoto にセット
  • 対象バージョンRELENG_1_2 にセット
  • 進捗率0 から 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 n-miyamoto7年以上前に更新

  • ステータス新規 から 解決 に変更
  • 進捗率90 から 100 に変更

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

#3 n-ando6年以上前に更新

  • ステータス解決 から 終了 に変更

他の形式にエクスポート: Atom PDF