Serialization stack overflow

32 views
Skip to first unread message

scott.m...@gmail.com

unread,
Jan 13, 2023, 9:14:41 AM1/13/23
to gtsam users
I have run into an issue where once my factor graph reaches a certain size (about 9,200 factors) serialization to binary fails with no exception thrown.  Debugging this using gdb, the backtrace is 543,332 levels deep so it seems like there is either an infinite recursion or else just a very expansive recursion that needs to be replaced with another kind of loop.  The two lines of GTSAM code that the program keeps bouncing between are:

#542768 gtsam::ISAM2Clique::serialize<boost::archive::binary_oarchive> (ar=..., this=0x7ffa7c001dd0) at .../install/gtsam/include/gtsam/nonlinear/ISAM2Clique.h:154

and

#542739 gtsam::BayesTreeCliqueBase<gtsam::ISAM2Clique, gtsam::GaussianFactorGraph>::serialize<boost::archive::binary_oarchive> (ar=..., this=0x7ffa7c001
dd0) at .../install/gtsam/include/gtsam/inference/BayesTreeCliqueBase.h:212

There is a TODO on line 211 of BayesTreeCliqueBase.h, not sure if it is related:

void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
  if(!parent_.lock()) {
    is_root = true;
  }
  ar & BOOST_SERIALIZATION_NVP(is_root);
  ar & BOOST_SERIALIZATION_NVP(conditional_);
  if (!is_root) { // TODO(fan): Workaround for boost/serialization #119
    ar & BOOST_SERIALIZATION_NVP(parent_);
  }
  ar & BOOST_SERIALIZATION_NVP(children);
}


This is using the latest checkout of the code but I got the same error using code from last summer.  Any suggestions about how I can debug this?  I'm not familiar with how cliques work so it is difficult to figure out where things are going wrong.

Thanks,
Scott
Reply all
Reply to author
Forward
0 new messages