Bus Error

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Bus Error

Montana
Running rtab standalone (rpi4 with realsense cameras) I can generate 3d maps and see odometry. I can export pngs of the occupancy, 3d clouds, etc. I can do the download all clouds or graph only, no problems. When I save this database and try to open it in the DatabaseViewer, it will not load, no matter what I try. I always get the following:

[ INFO] (2021-05-03 19:15:44.255) DBDriverSqlite3.cpp:426::connectDatabaseQuery() Database version = 0.20.10
[ INFO] (2021-05-03 19:15:44.428) DatabaseViewer.cpp:1645::updateIds() Loading all IDs...
[ INFO] (2021-05-03 19:15:44.894) DatabaseViewer.cpp:1885::updateIds() Loaded 54 ids, 54 poses and 15 links
Bus error

What does Bus Error mean, and what can I do to fix this?
Reply | Threaded
Open this post in threaded view
|

Re: Bus Error

matlabbe
Administrator
Can you share that database? Did you try to open it with another computer?
Reply | Threaded
Open this post in threaded view
|

Re: Bus Error

Montana
I cannot at the moment, but I can replicate it. Database files are created on windows or the RPI. Opening on the RPI. Tracing through seems to show that the issue occurs during decompression of obstacles.

SensorData.cpp - ctGroundCells.start();
and
SensorData.cpp - ctObstacleCells.start();

failing at:
Compression.cpp - cv::Mat uncompressData(const unsigned char * bytes, unsigned long size)

int errCode = uncompress(	(Bytef*)data.data,
				&totalUncompressed,
				(const Bytef*)bytes,
				uLong(size));

So either the compression or decompression is not happy for that feature. If I comment out the above lines for the ground cells and obstacles cells, the database will load. I can regenerate the occupancy grid, but saving and loading that with the lines uncommented will still fail. Loading the DB file on windows works just fine.
Reply | Threaded
Open this post in threaded view
|

Re: Bus Error

matlabbe
Administrator

Do you have many OpenCV installed versions on RPI? The wrong opencv dll is maybe loaded on runtime, then makes opencv functions crashing.

You can check with
ldd rtabmap
to see all dependencies loaded on runtime. If there is a mix of opencv versions, this could cause problems.
Reply | Threaded
Open this post in threaded view
|

Re: Bus Error

Montana
Seems like all the same version and location.
ldd rtabmap | grep libopencv*
	libopencv_gapi.so.4.5 => /usr/local/lib/libopencv_gapi.so.4.5 (0xf4321000)
	libopencv_stitching.so.4.5 => /usr/local/lib/libopencv_stitching.so.4.5 (0xf4294000)
	libopencv_alphamat.so.4.5 => /usr/local/lib/libopencv_alphamat.so.4.5 (0xf4266000)
	libopencv_aruco.so.4.5 => /usr/local/lib/libopencv_aruco.so.4.5 (0xf4202000)
	libopencv_barcode.so.4.5 => /usr/local/lib/libopencv_barcode.so.4.5 (0xf41e0000)
	libopencv_bgsegm.so.4.5 => /usr/local/lib/libopencv_bgsegm.so.4.5 (0xf41bc000)
	libopencv_bioinspired.so.4.5 => /usr/local/lib/libopencv_bioinspired.so.4.5 (0xf4183000)
	libopencv_ccalib.so.4.5 => /usr/local/lib/libopencv_ccalib.so.4.5 (0xf4135000)
	libopencv_dnn_objdetect.so.4.5 => /usr/local/lib/libopencv_dnn_objdetect.so.4.5 (0xf411d000)
	libopencv_dnn_superres.so.4.5 => /usr/local/lib/libopencv_dnn_superres.so.4.5 (0xf4103000)
	libopencv_dpm.so.4.5 => /usr/local/lib/libopencv_dpm.so.4.5 (0xf40df000)
	libopencv_face.so.4.5 => /usr/local/lib/libopencv_face.so.4.5 (0xf4075000)
	libopencv_freetype.so.4.5 => /usr/local/lib/libopencv_freetype.so.4.5 (0xf405e000)
	libopencv_fuzzy.so.4.5 => /usr/local/lib/libopencv_fuzzy.so.4.5 (0xf4043000)
	libopencv_hdf.so.4.5 => /usr/local/lib/libopencv_hdf.so.4.5 (0xf4029000)
	libopencv_hfs.so.4.5 => /usr/local/lib/libopencv_hfs.so.4.5 (0xf400c000)
	libopencv_img_hash.so.4.5 => /usr/local/lib/libopencv_img_hash.so.4.5 (0xf3fed000)
	libopencv_intensity_transform.so.4.5 => /usr/local/lib/libopencv_intensity_transform.so.4.5 (0xf3fc8000)
	libopencv_line_descriptor.so.4.5 => /usr/local/lib/libopencv_line_descriptor.so.4.5 (0xf3f9b000)
	libopencv_mcc.so.4.5 => /usr/local/lib/libopencv_mcc.so.4.5 (0xf3f3c000)
	libopencv_quality.so.4.5 => /usr/local/lib/libopencv_quality.so.4.5 (0xf3f20000)
	libopencv_rapid.so.4.5 => /usr/local/lib/libopencv_rapid.so.4.5 (0xf3f04000)
	libopencv_reg.so.4.5 => /usr/local/lib/libopencv_reg.so.4.5 (0xf3ee1000)
	libopencv_rgbd.so.4.5 => /usr/local/lib/libopencv_rgbd.so.4.5 (0xf3dcf000)
	libopencv_saliency.so.4.5 => /usr/local/lib/libopencv_saliency.so.4.5 (0xf3da7000)
	libopencv_stereo.so.4.5 => /usr/local/lib/libopencv_stereo.so.4.5 (0xf3d79000)
	libopencv_structured_light.so.4.5 => /usr/local/lib/libopencv_structured_light.so.4.5 (0xf3d5c000)
	libopencv_phase_unwrapping.so.4.5 => /usr/local/lib/libopencv_phase_unwrapping.so.4.5 (0xf3d44000)
	libopencv_superres.so.4.5 => /usr/local/lib/libopencv_superres.so.4.5 (0xf3d1d000)
	libopencv_optflow.so.4.5 => /usr/local/lib/libopencv_optflow.so.4.5 (0xf3cc3000)
	libopencv_surface_matching.so.4.5 => /usr/local/lib/libopencv_surface_matching.so.4.5 (0xf3c77000)
	libopencv_tracking.so.4.5 => /usr/local/lib/libopencv_tracking.so.4.5 (0xf3a9c000)
	libopencv_highgui.so.4.5 => /usr/local/lib/libopencv_highgui.so.4.5 (0xf3a79000)
	libopencv_datasets.so.4.5 => /usr/local/lib/libopencv_datasets.so.4.5 (0xf39f0000)
	libopencv_plot.so.4.5 => /usr/local/lib/libopencv_plot.so.4.5 (0xf39da000)
	libopencv_text.so.4.5 => /usr/local/lib/libopencv_text.so.4.5 (0xf397a000)
	libopencv_videostab.so.4.5 => /usr/local/lib/libopencv_videostab.so.4.5 (0xf3939000)
	libopencv_videoio.so.4.5 => /usr/local/lib/libopencv_videoio.so.4.5 (0xf38c4000)
	libopencv_wechat_qrcode.so.4.5 => /usr/local/lib/libopencv_wechat_qrcode.so.4.5 (0xf385c000)
	libopencv_xfeatures2d.so.4.5 => /usr/local/lib/libopencv_xfeatures2d.so.4.5 (0xf35d3000)
	libopencv_ml.so.4.5 => /usr/local/lib/libopencv_ml.so.4.5 (0xf3559000)
	libopencv_shape.so.4.5 => /usr/local/lib/libopencv_shape.so.4.5 (0xf352e000)
	libopencv_ximgproc.so.4.5 => /usr/local/lib/libopencv_ximgproc.so.4.5 (0xf3341000)
	libopencv_video.so.4.5 => /usr/local/lib/libopencv_video.so.4.5 (0xf32cd000)
	libopencv_dnn.so.4.5 => /usr/local/lib/libopencv_dnn.so.4.5 (0xf2f4f000)
	libopencv_xobjdetect.so.4.5 => /usr/local/lib/libopencv_xobjdetect.so.4.5 (0xf2f31000)
	libopencv_imgcodecs.so.4.5 => /usr/local/lib/libopencv_imgcodecs.so.4.5 (0xf2c8a000)
	libopencv_objdetect.so.4.5 => /usr/local/lib/libopencv_objdetect.so.4.5 (0xf2c15000)
	libopencv_calib3d.so.4.5 => /usr/local/lib/libopencv_calib3d.so.4.5 (0xf2a81000)
	libopencv_features2d.so.4.5 => /usr/local/lib/libopencv_features2d.so.4.5 (0xf29ea000)
	libopencv_flann.so.4.5 => /usr/local/lib/libopencv_flann.so.4.5 (0xf2991000)
	libopencv_xphoto.so.4.5 => /usr/local/lib/libopencv_xphoto.so.4.5 (0xf2928000)
	libopencv_photo.so.4.5 => /usr/local/lib/libopencv_photo.so.4.5 (0xf2896000)
	libopencv_imgproc.so.4.5 => /usr/local/lib/libopencv_imgproc.so.4.5 (0xf24d5000)
	libopencv_core.so.4.5 => /usr/local/lib/libopencv_core.so.4.5 (0xf21cc000)
I built it local with:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
        -D ENABLE_NEON=ON \
        -D ENABLE_VFPV3=ON \
        -D WITH_OPENMP=ON \
        -D BUILD_TIFF=ON \
        -D WITH_FFMPEG=ON \
        -D WITH_TBB=ON \
        -D BUILD_TBB=ON \
        -D BUILD_TESTS=OFF \
        -D WITH_EIGEN=ON \
        -D WITH_V4L=ON \
        -D WITH_LIBV4L=ON \
        -D WITH_VTK=OFF \
        -D WITH_QT=OFF \
        -D OPENCV_ENABLE_NONFREE=ON \
        -D INSTALL_C_EXAMPLES=OFF \
        -D INSTALL_PYTHON_EXAMPLES=OFF \
        -D BUILD_NEW_PYTHON_SUPPORT=ON \
        -D BUILD_opencv_python3=TRUE \
        -D OPENCV_GENERATE_PKGCONFIG=ON \
        -D BUILD_EXAMPLES=OFF ..
Could I have missed something here?
Reply | Threaded
Open this post in threaded view
|

Re: Bus Error

matlabbe
Administrator
try gdb:

gdb rtabmap-databaseViewer

type "start"

then "bt" after crash to see the traceback.
Reply | Threaded
Open this post in threaded view
|

Re: Bus Error

Montana
Thread 1 "rtabmap-databas" received signal SIGBUS, Bus error.
0xf5da0638 in rtabmap::uncompressData(unsigned char const*, unsigned long) ()
   from /usr/local/lib/librtabmap_core.so.0.20
(gdb) bt
#0  0xf5da0638 in rtabmap::uncompressData(unsigned char const*, unsigned long)
    () at /usr/local/lib/librtabmap_core.so.0.20
#1  0xf5da0860 in rtabmap::uncompressData(cv::Mat const&) ()
    at /usr/local/lib/librtabmap_core.so.0.20
#2  0xf5bfdf08 in rtabmap::DBDriverSqlite3::load2DMapQuery(float&, float&, float&) const () at /usr/local/lib/librtabmap_core.so.0.20
#3  0xf5beb024 in rtabmap::DBDriver::load2DMap(float&, float&, float&) const ()
    at /usr/local/lib/librtabmap_core.so.0.20
#4  0xf7d36638 in rtabmap::DatabaseViewer::updateIds() ()
    at /usr/local/lib/librtabmap_gui.so.0.20
#5  0xf7d38bcc in rtabmap::DatabaseViewer::openDatabase(QString const&) ()
    at /usr/local/lib/librtabmap_gui.so.0.20
#6  0xf7d390ec in rtabmap::DatabaseViewer::openDatabase() ()
    at /usr/local/lib/librtabmap_gui.so.0.20
#7  0xe74cb244 in QMetaObject::activate(QObject*, int, int, void**) ()
    at /lib/arm-linux-gnueabihf/libQt5Core.so.5
#8  0xe7c47d58 in QAction::triggered(bool) ()
    at /lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#9  0xe7c4a774 in QAction::activate(QAction::ActionEvent) ()
    at /lib/arm-linux-gnueabihf/libQt5Widgets.so.5
Reply | Threaded
Open this post in threaded view
|

Re: Bus Error

matlabbe
Administrator
It looks related to https://github.com/introlab/rtabmap_ros/issues/50

The uncompress function used in uncompressData is coming from the zlib library. If you do "ldd /usr/local/lib/librtabmap_core.so.0.20", which zlib is used?

Other similar posts:
https://redmine.lighttpd.net/issues/1879
From (libextractor seems using zlib):
https://www.gnu.org/software/libextractor/manual/html_node/Extracting.html
Meta data extraction should never really fail — at worst, GNU libextractor should not call ‘proc’ with any meta data. By design, GNU libextractor should never crash or leak memory, even given corrupt files as input. Note however, that running GNU libextractor on a corrupt file system (or incorrectly mmaped files) can result in the operating system sending a SIGBUS (bus error) to the process. While GNU libextractor runs plugins out-of-process, it first maps the file into memory and then attempts to decompress it. During decompression it is possible to encounter a SIGBUS. GNU libextractor will not attempt to catch this signal and your application is likely to crash. Note again that this should only happen if the file system is corrupt (not if individual files are corrupt). If this is not acceptable, you might want to consider running GNU libextractor itself also out-of-process (as done, for example, by doodle).
Which OS are you using with RPI4? In the past, I tested on Ubuntu Mate (on RPI3 and RPI4) and I didn't have problems with rtabmap.