PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
10k stars 4.62k forks source link

Poisson reconstruction in parallel threads segfaults #1845

Open nblythe opened 7 years ago

nblythe commented 7 years ago

Your Environment

Expected Behavior

Two threads should be able to create two different instances of pcl::Poisson and run them on two different input clouds at the same time.

Current Behavior

Segfault

Code to Reproduce

http://pastebin.com/yJrpcpTL

nblythe commented 7 years ago

Confirmed this is in trunk too

nblythe commented 7 years ago

The problem is surface/include/pcl/surface/3rdparty/poisson4/allocator.h, which isn't thread-safe and is instantiated statically by octree_poisson.h and sparse_matrix.h.

nblythe commented 7 years ago

Possible fixes include switching to member instances instead of static instances (will break memory usage reporting) and mutex-locking allocations.

nblythe commented 7 years ago

Unfortunately there's no easy fix for this. Switching to member instances isn't straightforward, because SetAllocator() is called out-of-scope in several places. Mutex-locking allocations won't work because Allocator exposes state that implies single-consumer. The best fix would be to write new thread-safe implementation of Allocator.

stale[bot] commented 4 years ago

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

stale[bot] commented 4 years ago

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.