PointCloudLibrary / PointCloudLibrary/pcl

[io] savePCDFileBinaryCompressed pcd file can't open with coredump error

Open
#4,958 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: bug module: io
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

Describe the bug
We use pcl::io::savePCDFileBinaryCompressed(label_pcd_Name, *cloud_out); to save our pcd file, and in most situation ,it works well. But in same output file(2 pcd files in 100k), it will meet coredump error like Loading /mnt/data/Lidar_B3_1632536240.453701.pcd [1] 24581 bus error (core dumped) , Even though we use different tools.

Context

What are you trying to accomplish? Providing context helps us come up with a solution that is most useful in the real world

pcd file header

# .PCD v0.7 - Point Cloud Data file format
VERSION 0.7
FIELDS x y z intensity timestamp ring
SIZE 4 4 4 1 8 2
TYPE F F F U F U
COUNT 1 1 1 1 1 1
WIDTH 317794
HEIGHT 1
VIEWPOINT 0 0 0 1 0 0 0
POINTS 317794
DATA binary_compressed

Although 317,794 point clouds are described in the header, the file size is actually only 2.2M, which is half smaller than the normal 4.5M.

pcl_viewer:

(base) ➜  build git:(dev) /usr/bin/pcl_viewer /mnt/data/Lidar_B3_1632536240.453701.pcd 
The viewer window provides interactive commands; for help, press 'h' or 'H' from within the window.
> Loading /mnt/data/Lidar_B3_1632536240.453701.pcd [1]    24581 bus error (core dumped)  /usr/bin/pcl_viewer /mnt/data/Lidar_B3_1632536240.453701.pcd

cloudcompare :
2021928-91222

gdb meesage :

(gdb) where
#0  0x00007ffff6e8311a in pcl::lzfDecompress(void const*, unsigned int, void*, unsigned int) () from /usr/lib/x86_64-linux-gnu/libpcl_io.so.1.8
#1  0x00007ffff6e40e7e in pcl::PCDReader::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, pcl::PCLPointCloud2&, Eigen::Matrix<float, 4, 1, 0, 4, 1>&, Eigen::Quaternion<float, 0>&, int&, int) () from /usr/lib/x86_64-linux-gnu/libpcl_io.so.1.8
#2  0x0000555555572cbf in main ()

Expected behavior

A clear and concise description of what you expected to happen.
read pcd and points ok

Current Behavior

What happens instead of the expected behavior?
pcd file can't read with coredump

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. A reproducible example helps to provide faster answers.

Screenshots/Code snippets

In order to help explain your problem, please consider adding

  • screenshots of the GUI issues
  • code snippets: syntax for code with correct language highlights
          pcl::io::savePCDFileBinaryCompressed(fileName, *cloud_out);
          std::cout << "save frame: " << frameItem << " to  pcd: " << fileName
                    << std::endl;

Your Environment (please complete the following information):

  • OS: [Ubuntu 18.04]
  • Compiler: [ GCC 7.5]
  • PCL Version [1.9] we use 1.9 to generate pcds and use 1.8 to view(pcl_viewer) pcd

Possible Solution

Not obligatory, but suggest a fix/reason for the bug. Feel free to create a PR if you feel comfortable.

Additional context

Add any other context about the problem here.

origin pcd file is here
Lidar_B3_1632536240.453701.zip

normal_and_coredump_2pcd.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the attached failing and normal PCD archives, then trace pcl::io::savePCDFileBinaryCompressed through pcl::lzfDecompress and PCDReader::read. Compare files generated with PCL 1.9 against those read by PCL 1.8, using pcl_viewer to reproduce the crash. Done means the supplied compressed file loads correctly without a bus error and the reported point count is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.