[custom] How can I debug crashes in which deallocation of point clouds uses the wrong point type?
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 20/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- cpp
调研方向
以 AddressSanitizer 回溯为切入点,沿着 filter.h 和 point_cloud.h 跟进到 Eigen's Memory.h。将 PointXYZRGB 的释放路径与跟踪信息中显示的 PointXYZL 分配进行比较,包括 PCL_NO_PRECOMPILE 和所列构建标志的影响。完成的标准是确定一个可复现的原因,或为不匹配的点类型提供精确的调试指导。
由索引模型根据 Issue 内容生成。
描述
I often have this issue – not reproducible minimally – that my PCL client code crashes with some sort of
pointer being freed was not allocated
message, that usually goes away when I #define PCL_NO_PRECOMPILE at the top of my offending source file. With clang's address sanitizer, I get interesting reports that seem to indicate that a point cloud created as one point type gets deallocated as a different one. For instance check out this backtrace:
==47757==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x0001270383f8 at pc 0x000100af7ad8 bp 0x00016f4acd30 sp 0x00016f4acd28
READ of size 8 at 0x0001270383f8 thread T0
#0 0x100af7ad4 in Eigen::internal::handmade_aligned_free(void*) Memory.h:118
#1 0x100af7a5c in Eigen::internal::aligned_free(void*) Memory.h:206
#2 0x100e01ce8 in Eigen::aligned_allocator<pcl::PointXYZRGB>::deallocate(pcl::PointXYZRGB*, unsigned long) Memory.h:897
#3 0x100e01b18 in std::__1::allocator_traits<Eigen::aligned_allocator<pcl::PointXYZRGB> >::deallocate(Eigen::aligned_allocator<pcl::PointXYZRGB>&, pcl::PointXYZRGB*, unsigned long)
allocator_traits.h:282
#4 0x100e01804 in std::__1::__vector_base<pcl::PointXYZRGB, Eigen::aligned_allocator<pcl::PointXYZRGB> >::~__vector_base() vector:488
#5 0x100e015c4 in std::__1::vector<pcl::PointXYZRGB, Eigen::aligned_allocator<pcl::PointXYZRGB> >::~vector() vector:579
#6 0x100e00f70 in std::__1::vector<pcl::PointXYZRGB, Eigen::aligned_allocator<pcl::PointXYZRGB> >::~vector() vector:574
#7 0x100e03294 in pcl::PointCloud<pcl::PointXYZRGB>::~PointCloud() point_cloud.h:172
#8 0x100e03254 in pcl::PointCloud<pcl::PointXYZRGB>::~PointCloud() point_cloud.h:172
#9 0x103cc6510 in pcl::Filter<pcl::PointXYZRGB>::filter(pcl::PointCloud<pcl::PointXYZRGB>&) filter.h:134
#10 0x103c6e6a8 in myfunction(mydata*) myfile.cpp:122
…
#14 0x114051088 in start+0x204 (dyld:arm64e+0x5088)
0x0001270383f8 is located 8 bytes to the left of 52256-byte region [0x000127038400,0x000127045020)
allocated by thread T0 here:
#0 0x120656ca8 in wrap_malloc+0x94 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3eca8)
#1 0x1169024d4 in std::__1::__split_buffer<pcl::PointXYZL, Eigen::aligned_allocator<pcl::PointXYZL>&>::__split_buffer(unsigned long, unsigned long, Eigen::aligned_allocator<pcl::Poi
ntXYZL>&)+0x30 (libpcl_filters.1.13.0.99.dylib:arm64+0x464d4)
#2 0x1169037e4 in std::__1::vector<pcl::PointXYZRGB, Eigen::aligned_allocator<pcl::PointXYZRGB> >::__append(unsigned long)+0x68 (libpcl_filters.1.13.0.99.dylib:arm64+0x477e4)
#3 0x116a89e94 in pcl::VoxelGrid<pcl::PointXYZRGB>::applyFilter(pcl::PointCloud<pcl::PointXYZRGB>&)+0xaf0 (libpcl_filters.1.13.0.99.dylib:arm64+0x1cde94)
#4 0x103cc63a4 in pcl::Filter<pcl::PointXYZRGB>::filter(pcl::PointCloud<pcl::PointXYZRGB>&) filter.h:129
#5 0x103c6e6a8 in myfunction(mydata*) myfile.cpp:122
SUMMARY: AddressSanitizer: heap-buffer-overflow Memory.h:118 in Eigen::internal::handmade_aligned_free(void*)
Shadow bytes around the buggy address:
0x007024e27020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x007024e27030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x007024e27040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x007024e27050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x007024e27060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x007024e27070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]
0x007024e27080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x007024e27090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x007024e270a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x007024e270b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x007024e270c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==47757==ABORTING
Abort trap: 6
So why is the deallocator called on the correct PointXYZRGB points, but the filter class somehow creates data of type PointXYZL?
The presence or absence of -DPCL_ONLY_CORE_POINT_TYPES=ON and -DNO_EXPLICIT_INSTANTIATIONS makes no difference by the way.
What can I do to debug this?
- 主要语言
- C++
- 星标
- 11.2k
- 派生
- 4.7k
- 平均合并
- 6 天 13 小时
- 30 天内合并 PR
- 10
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PointCloudLibrary/pcl 的其他 Issue
-
kind: bug status: triage
难度 1/5 1 小时以内 新手友好度 82/100
PointCloudLibrary/pcl#6536 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
PointCloudLibrary/pcl#6509 · 1 条评论 ·
维护者通常 3 天内回复
-
kind: bug status: triage
难度 4/5 3-5 天 新手友好度 48/100
PointCloudLibrary/pcl#6537 ·
维护者通常 3 天内回复
-
[cmake] QHULL/FLANN dll missing when linking single module可能已有人在做 @SIDDARTHAREDDY8 于 6 天前认领。 未关闭kind: bug module: cmake
难度 3/5 半天 新手友好度 50/100
PointCloudLibrary/pcl#6522 · 1 条评论 ·
维护者通常 3 天内回复
-
kind: bug status: triage
难度 4/5 3-5 天 新手友好度 35/100
PointCloudLibrary/pcl#6395 ·
维护者通常 3 天内回复
查看 PointCloudLibrary/pcl 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
HarperFast/rocksdb-js#1131 ·
维护者通常 1 天内回复
-
area/daemon bug good first issue platform/linux priority/p2
难度 2/5 1-3 小时 新手友好度 72/100
ToshiNamura/Deimos#5 ·
-
needs-format
难度 2/5 1-3 小时 新手友好度 82/100
Niko1221/Strata#6251 · 1 条评论 ·
维护者通常 5 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
metasequoiaime/msime#11666 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
patrick-hudson/put.gd-desktop#1679 · 1 条评论 ·
维护者通常 1 天内回复