introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.75k stars 785 forks source link

standalone binary release for windows crashes when g2o graph match has been selected. #149

Closed zjsprit closed 7 years ago

zjsprit commented 7 years ago

Recently, I can sucessfuly run the standalone binary release (RTABMap-0.11.11-win64.exe) in the Windows 8.1, but if I select the g2o in the Graph Optimization of the Perferences panels , the program crashes when close and exit from the program. Can you give me some suggestions? My Selection and the abnormal dialog are as follows pictures: preferences

abnormal

matlabbe commented 7 years ago

Hi,

thx for the observation. I can reproduce the error too. Hopefully, the crash happens after closing everything, so the database and config are correctly saved. The crash may happen when releasing g2o DLL. I'll update g2o version used in Windows binaries to see if the crash still happen.

cheers

matlabbe commented 7 years ago

More info (this is with the latest code of g2o in Release mode): capture

matlabbe commented 7 years ago

By building g2o in debug mode, we can see that it is crashing when unregistering action right there.

If I set -DG2O_DEBUG_ACTIONLIB when building g2o:

...\rtabmap\bin>RTABMap.exe
g2o::RegisterActionProxy<class g2o::VertexSE2WriteGnuplotAction>::RegisterActionProxy: Registering action of type class g2o::VertexSE2WriteGnuplotAction
g2o::HyperGraphActionLibrary::registerAction: creating collection for "writeGnuplot"
g2o::HyperGraphElementActionCollection::registerAction writeGnuplot class g2o::VertexSE2
g2o::RegisterActionProxy<class g2o::VertexPointXYWriteGnuplotAction>::RegisterActionProxy: Registering action of type class g2o::VertexPointXYWriteGnuplotAction
g2o::HyperGraphElementActionCollection::registerAction writeGnuplot class g2o::VertexPointXY
g2o::RegisterActionProxy<class g2o::EdgeSE2WriteGnuplotAction>::RegisterActionProxy: Registering action of type class g2o::EdgeSE2WriteGnuplotAction
g2o::HyperGraphElementActionCollection::registerAction writeGnuplot class g2o::EdgeSE2
g2o::RegisterActionProxy<class g2o::EdgeSE2PointXYWriteGnuplotAction>::RegisterActionProxy: Registering action of type class g2o::EdgeSE2PointXYWriteGnuplotAction
g2o::HyperGraphElementActionCollection::registerAction writeGnuplot class g2o::EdgeSE2PointXY
g2o::RegisterActionProxy<class g2o::EdgeSE2PointXYBearingWriteGnuplotAction>::RegisterActionProxy: Registering action of type class g2o::EdgeSE2PointXYBearingWriteGnuplotAction
g2o::HyperGraphElementActionCollection::registerAction writeGnuplot class g2o::EdgeSE2PointXYBearing
g2o::RegisterActionProxy<class g2o::VertexSE2DrawAction>::RegisterActionProxy: Registering action of type class g2o::VertexSE2DrawAction
g2o::HyperGraphActionLibrary::registerAction: creating collection for "draw"
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::VertexSE2
g2o::RegisterActionProxy<class g2o::VertexPointXYDrawAction>::RegisterActionProxy: Registering action of type class g2o::VertexPointXYDrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::VertexPointXY
g2o::RegisterActionProxy<class g2o::EdgeSE2DrawAction>::RegisterActionProxy: Registering action of type class g2o::EdgeSE2DrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::EdgeSE2
g2o::RegisterActionProxy<class g2o::EdgeSE2PointXYDrawAction>::RegisterActionProxy: Registering action of type class g2o::EdgeSE2PointXYDrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::EdgeSE2PointXY
g2o::RegisterActionProxy<class g2o::EdgeSE2PointXYBearingDrawAction>::RegisterActionProxy: Registering action of type class g2o::EdgeSE2PointXYBearingDrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::EdgeSE2PointXYBearing
g2o::RegisterActionProxy<class g2o::VertexSE3WriteGnuplotAction>::RegisterActionProxy: Registering action of type class g2o::VertexSE3WriteGnuplotAction
g2o::HyperGraphElementActionCollection::registerAction writeGnuplot class g2o::VertexSE3
g2o::RegisterActionProxy<class g2o::VertexPointXYZWriteGnuplotAction>::RegisterActionProxy: Registering action of type class g2o::VertexPointXYZWriteGnuplotAction
g2o::HyperGraphElementActionCollection::registerAction writeGnuplot class g2o::VertexPointXYZ
g2o::RegisterActionProxy<class g2o::EdgeSE3WriteGnuplotAction>::RegisterActionProxy: Registering action of type class g2o::EdgeSE3WriteGnuplotAction
g2o::HyperGraphElementActionCollection::registerAction writeGnuplot class g2o::EdgeSE3
g2o::RegisterActionProxy<class g2o::VertexPointXYZDrawAction>::RegisterActionProxy: Registering action of type class g2o::VertexPointXYZDrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::VertexPointXYZ
g2o::RegisterActionProxy<class g2o::VertexSE3DrawAction>::RegisterActionProxy: Registering action of type class g2o::VertexSE3DrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::VertexSE3
g2o::RegisterActionProxy<class g2o::EdgeSE3DrawAction>::RegisterActionProxy: Registering action of type class g2o::EdgeSE3DrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::EdgeSE3
g2o::RegisterActionProxy<class g2o::EdgeSE3PointXYZDrawAction>::RegisterActionProxy: Registering action of type class g2o::EdgeSE3PointXYZDrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::EdgeSE3PointXYZ
g2o::RegisterActionProxy<class g2o::EdgeProjectDisparityDrawAction>::RegisterActionProxy: Registering action of type class g2o::EdgeProjectDisparityDrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::EdgeSE3PointXYZDisparity
g2o::RegisterActionProxy<class g2o::CacheCameraDrawAction>::RegisterActionProxy: Registering action of type class g2o::CacheCameraDrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::CacheCamera
g2o::RegisterActionProxy<class g2o::CacheSE3OffsetDrawAction>::RegisterActionProxy: Registering action of type class g2o::CacheSE3OffsetDrawAction
g2o::HyperGraphElementActionCollection::registerAction draw class g2o::CacheSE3Offset

***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****

libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
[ WARN] (2016-11-30 13:31:46) Parameters.cpp:737::rtabmap::Parameters::readINI() Parameter migration from "Optimizer/Slam2D" to "Reg/Force3DoF" (value=false, default=false).
[ WARN] (2016-11-30 13:31:52) CameraModel.cpp:288::rtabmap::CameraModel::load() Could not load calibration file "C:/Users/Mathieu/Documents/RTAB-Map/camera_info/Kinect_depth.yaml".
[ WARN] (2016-11-30 13:31:52) CameraModel.cpp:288::rtabmap::CameraModel::load() Could not load calibration file "C:/Users/Mathieu/Documents/RTAB-Map/camera_info/Kinect_rgb.yaml".
[ WARN] (2016-11-30 13:31:52) CameraRGBD.cpp:557::rtabmap::CameraOpenNI2::init() Missing calibration files for camera "Kinect" in "C:/Users/Mathieu/Documents/RTAB-Map/camera_info" folder, default calibration used.
User Error 1001: argument to num_threads clause must be positive
User Error 1001: argument to num_threads clause must be positive
User Error 1001: argument to num_threads clause must be positive

<<<< Scan a little then close >>>>>

QMutex: destroying locked mutex
g2o::RegisterActionProxy<class g2o::CacheSE3OffsetDrawAction>::~RegisterActionProxy: Unregistering action of type class g2o::CacheSE3OffsetDrawAction
<<<<< crash here on line linked above >>>>>

If I remove these lines from OptimizerG2O.cpp, the crash is fixed:

optimizer.clear();
g2o::Factory::destroy();
g2o::OptimizationAlgorithmFactory::destroy();
g2o::HyperGraphActionLibrary::destroy();

I think the problem is coming from g2o::HyperGraphActionLibrary::destroy();, which may delete all actions. So when the static objects are deleted on exit, the actions are already deleted, causing the crash. Anyway, I don't think destroying the instances each time we call g2o is required, so I removed this line in the referred commit above.

zjsprit commented 7 years ago

I really appreciate your help! Thank you!