cv::connectedComponents stuck or seg fault

asked 2018-04-23 00:52:23 -0500

hovnatan gravatar image

updated 2018-04-23 01:29:41 -0500

Hi, when I use cv::connectedComponents in a multithreaded application it gets stuck with this stack trace

1   sched_yield syscall-template.S 78  0x7f9a38ccae57 
2   tbb::internal::custom_scheduler<tbb::internal::IntelSchedulerTraits>::local_wait_for_all(tbb::task&, tbb::task *) 0x7f9a389b5b75 
3   tbb::internal::generic_scheduler::local_spawn_root_and_wait(tbb::task *, tbb::task *&) 0x7f9a389b53d0 
4   tbb::interface9::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner const>::run(tbb::blocked_range<int> const&, (anonymous namespace)::ProxyLoopBody const&, tbb::auto_partitioner const&) [clone .isra.27] [clone .constprop.47]  0x7f9a3b4561f7 
5   tbb::interface7::internal::delegated_function<(anonymous namespace)::ProxyLoopBody, void>::operator()() const 0x7f9a3b45627b 
6   tbb::interface7::internal::task_arena_base::internal_execute(tbb::interface7::internal::delegate_base&) const 0x7f9a389a8acf 
7   cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double) 0x7f9a3b456508 
8   int cv::connectedComponents_sub1<cv::connectedcomponents::NoOp>(cv::Mat const&, cv::Mat&, int, int, cv::connectedcomponents::NoOp&) 0x7f9a3c227ca7 
9   cv::connectedComponents(cv::_InputArray const&, cv::_OutputArray const&, int, int, int) 0x7f9a3c22995f

or sometimes seg faults with the stack trace

1   tbb::internal::custom_scheduler<tbb::internal::IntelSchedulerTraits>::local_wait_for_all(tbb::task&, tbb::task *) 0x7f628e35dbe8 
2   tbb::internal::generic_scheduler::local_spawn_root_and_wait(tbb::task *, tbb::task *&) 0x7f628e35d3d0 
3   tbb::interface9::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner const>::run(tbb::blocked_range<int> const&, (anonymous namespace)::ProxyLoopBody const&, tbb::auto_partitioner const&) [clone .isra.27] [clone .constprop.47 0x7f6290dfe1f7 
4   tbb::interface7::internal::delegated_function<(anonymous namespace)::ProxyLoopBody, void>::operator()() const 0x7f6290dfe27b 
5   tbb::interface7::internal::task_arena_base::internal_execute(tbb::interface7::internal::delegate_base&) const 0x7f628e350acf 
6   cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double) 0x7f6290dfe508 
7   int cv::connectedComponents_sub1<cv::connectedcomponents::NoOp>(cv::Mat const&, cv::Mat&, int, int, cv::connectedcomponents::NoOp&) 0x7f6291bcfca7 
8   cv::connectedComponents(cv::_InputArray const&, cv::_OutputArray const&, int, int, int) 0x7f6291bd195f

I am guessing the problem is coming from multithreading limits in the process since both TBB and the program are multithreaded. Or it can be a bug on my multithreaded code. Can anyone please help debug this issue? I use OpenCV 3.4.1 on Ubuntu.

edit retag flag offensive close merge delete

Comments

can you please replace the unusable screenshot with a text version ? thank you.

berak gravatar imageberak ( 2018-04-23 00:58:07 -0500 )edit
1

@berak done

hovnatan gravatar imagehovnatan ( 2018-04-23 01:30:04 -0500 )edit