Changes have been pushed for the repository "fawkes.git".
(Fawkes Robotics Software Framework)

Clone:  g...@git.fawkesrobotics.org:fawkes.git
Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, thofmann/robot-memory-fix-oplog-exception has been updated
  discards  de293be5287d7c43d65bd9f8199b3f76c4d23fa8 (commit)
        to  7388efe2160fc56d872ef84b4e231dc63b0b19da (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (de293be5287d7c43d65bd9f8199b3f76c4d23fa8)
            \
             N -- N -- N (7388efe2160fc56d872ef84b4e231dc63b0b19da)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

http://git.fawkesrobotics.org/fawkes.git/thofmann/robot-memory-fix-oplog-exception

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- *Log* ---------------------------------------------------------------
commit 7388efe2160fc56d872ef84b4e231dc63b0b19da
Author:     Till Hofmann <hofm...@kbsg.rwth-aachen.de>
AuthorDate: Sun Jun 17 16:48:23 2018 -0400
Commit:     Till Hofmann <hofm...@kbsg.rwth-aachen.de>
CommitDate: Sun Jun 17 16:50:13 2018 -0400

    robot-memory: if try-lock throws an exception, check if we got the mutex
    
    Sometimes, a MongoDB exception is thrown, but we still acquired the
    mutex. To detect this case, try to check the database whether we
    acquired the mutex, and if we did, let the try-lock succeed. Otherwise,
    or if there is another exception, return false and report an error.
    
    Thanks to Daniel Habering for debugging and suggestions on the error
    handling.

http://git.fawkesrobotics.org/fawkes.git/commit/7388efe
http://trac.fawkesrobotics.org/changeset/7388efe

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------


- *Diffs* -------------------------------------------------------------

- *commit* 7388efe2160fc56d872ef84b4e231dc63b0b19da - - - - - - - - - -
Author:  Till Hofmann <hofm...@kbsg.rwth-aachen.de>
Date:    Sun Jun 17 16:48:23 2018 -0400
Subject: robot-memory: if try-lock throws an exception, check if we got the 
mutex

 src/plugins/robot-memory/robot_memory.cpp |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/robot-memory/robot_memory.cpp 
b/src/plugins/robot-memory/robot_memory.cpp
index 37d48f0..f696a09 100644
--- a/src/plugins/robot-memory/robot_memory.cpp
+++ b/src/plugins/robot-memory/robot_memory.cpp
@@ -877,9 +877,31 @@ RobotMemory::mutex_try_lock(const std::string& name,
                        new_doc.getField("locked").Bool());
 
        } catch (mongo::OperationException &e) {
-               //if (e.obj()["code"].numberInt() != 11000) {
-               // 11000: Duplicate key exception, occurs if we do not become 
leader, all fine
-               return false;
+    logger_->log_error(name_, "Mongo OperationException: %s", e.what());
+    try {
+      mongo::BSONObjBuilder check_doc;
+      check_doc.append("_id", name);
+      check_doc.append("locked", true);
+      check_doc.append("locked-by", identity);
+      BSONObj res_doc  =
+        client->findOne(cfg_coord_mutex_collection_, check_doc.obj());
+      logger_->log_info(name_, "Checking whether mutex was acquired 
succeeded");
+      if (!res_doc.isEmpty()) {
+        logger_->log_warn(name_,
+            "Exception during try-lock for %s, but mutex was still acquired",
+            name.c_str());
+      } else {
+        logger_->log_info(name_,
+            "Exception during try-lock for %s, and mutex was not acquired",
+            name.c_str());
+      }
+      return !res_doc.isEmpty();
+    } catch (mongo::OperationException &e) {
+      logger_->log_error(name_,
+        "Mongo OperationException while handling the first exception: %s",
+        e.what());
+      return false;
+    }
        }
 }
 




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org
_______________________________________________
fawkes-commits mailing list
fawkes-commits@lists.kbsg.rwth-aachen.de
https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits

Reply via email to