gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.17k stars 477 forks source link

Flaky UNIT_CameraSensor_TEST seg-fault #1863

Closed osrf-migration closed 8 years ago

osrf-migration commented 8 years ago

Original report (archived issue) by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


I've seen some flakiness in UNIT_CameraSensor_TEST in overnight testing of the default branch and have gotten repeatable backtraces. The flakiness may be present in the gazebo7 branch as well.

Console output:

$ gazebo/sensors/UNIT_CameraSensor_TEST 
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from CameraSensor_TEST
[ RUN      ] CameraSensor_TEST.CreateCamera
[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 172.23.2.91
[Err] [Scene.cc:2927] Light [sun] not found. Use topic ~/factory/light to spawn a new light.
[Dbg] [ServerFixture.cc:200] ServerFixture load in 1 seconds, timeout after 600 seconds
Segmentation fault (core dumped)

The backtrace show the seg-fault occuring at SensorManager.cc:697 when it calls event::Events::render();.

(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007f7d52341195 in operator() (this=<optimized out>) at /usr/include/boost/function/function_template.hpp:767
#2  gazebo::event::EventT<void ()>::Signal() (this=0x7f7d512bc7e0 <gazebo::event::Events::render>)
    at gazebo/common/Event.hh:365
#3  0x00007f7d523459d3 in operator() (this=<optimized out>) at gazebo/common/Event.hh:209
#4  gazebo::sensors::SensorManager::ImageSensorContainer::Update (this=0x7f7d282f4c30, _force=<optimized out>)
    at gazebo/sensors/SensorManager.cc:697
#5  0x00007f7d523461cf in gazebo::sensors::SensorManager::Update (this=0x672da0 <SingletonT<gazebo::sensors::SensorManager>::GetInstance()::t>, 
    _force=<optimized out>) at gazebo/sensors/SensorManager.cc:171
#6  0x00007f7d525b60a7 in gazebo::Server::Run (this=0x7f7d28000920) at gazebo/Server.cc:562
#7  0x0000000000414ec6 in gazebo::ServerFixture::RunServer (this=0x15f9230, _args=...)
    at gazebo/test/ServerFixture.cc:270
#8  0x00007f7d505c3a4a in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0
#9  0x00007f7d51b5b182 in start_thread (arg=0x7f7d2ed28700) at pthread_create.c:312
#10 0x00007f7d4f6b347d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb)

In two cases, the seg-fault occurs when the main testing thread is at CameraSensor_TEST.cc:40. The strange thing is that this line is calling GetSensor and then casting it to a CameraSensor, but the backtrace shows a ~CameraSensor destructor being called. That doesn't make sense to me.

Thread 18 (Thread 0x7f7d52974880 (LWP 18077)):
#0  boost::detail::sp_counted_impl_p<gazebo::transport::Publisher>::dispose (this=0x7f7d28e6ed40)
    at /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:78
#1  0x00007f7d516ee90e in boost::detail::sp_counted_base::release (this=0x7f7d28e6ed40)
    at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:146
#2  0x00007f7d5170ea0c in ~shared_count (this=0x7f7d28e6e948, __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:371
#3  ~shared_ptr (this=0x7f7d28e6e940, __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/shared_ptr.hpp:328
#4  _Destroy<boost::shared_ptr<gazebo::transport::Publisher> > (__pointer=0x7f7d28e6e940) at /usr/include/c++/4.8/bits/stl_construct.h:93
#5  __destroy<boost::shared_ptr<gazebo::transport::Publisher>*> (__last=<optimized out>, __first=0x7f7d28e6e940)
    at /usr/include/c++/4.8/bits/stl_construct.h:103
#6  _Destroy<boost::shared_ptr<gazebo::transport::Publisher>*> (__last=<optimized out>, __first=<optimized out>)
    at /usr/include/c++/4.8/bits/stl_construct.h:126
#7  _Destroy<boost::shared_ptr<gazebo::transport::Publisher>*, boost::shared_ptr<gazebo::transport::Publisher> > (__last=0x7f7d28e6e950, 
    __first=0x7f7d28e6e930) at /usr/include/c++/4.8/bits/stl_construct.h:151
#8  _M_erase_at_end (this=<optimized out>, __pos=0x7f7d28e6e930) at /usr/include/c++/4.8/bits/stl_vector.h:1352
#9  clear (this=0x7f7d28dce9f0) at /usr/include/c++/4.8/bits/stl_vector.h:1126
#10 gazebo::transport::Node::Fini (this=0x7f7d28dce9d0) at gazebo/transport/Node.cc:70
#11 0x00007f7d5233f46e in gazebo::sensors::Sensor::~Sensor (this=0x7f7d28eb68c0, __in_chrg=<optimized out>)
    at gazebo/sensors/Sensor.cc:78
#12 0x00007f7d5230b419 in gazebo::sensors::CameraSensor::~CameraSensor (this=0x7f7d28eb68c0, __in_chrg=<optimized out>)
    at gazebo/sensors/CameraSensor.cc:64
#13 0x00000000004135b9 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x7f7d28e37fe0)
    at /usr/include/c++/4.8/bits/shared_ptr_base.h:144
#14 0x0000000000411b84 in ~__shared_count (this=<synthetic pointer>, __in_chrg=<optimized out>) at /usr/include/c++/4.8/bits/shared_ptr_base.h:546
#15 ~__shared_ptr (this=<synthetic pointer>, __in_chrg=<optimized out>) at /usr/include/c++/4.8/bits/shared_ptr_base.h:781
#16 ~shared_ptr (this=<synthetic pointer>, __in_chrg=<optimized out>) at /usr/include/c++/4.8/bits/shared_ptr.h:93
#17 CameraSensor_TEST_CreateCamera_Test::TestBody (this=<optimized out>)
    at gazebo/sensors/CameraSensor_TEST.cc:40
#18 0x0000000000450963 in HandleSehExceptionsInMethodIfSupported<testing::Test, void> (location=0x45904f "the test body", method=<optimized out>, 
    object=<optimized out>) at test/gtest/src/gtest.cc:2079
#19 testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void> (object=object@entry=0x15f9230, method=<optimized out>, 
    location=location@entry=0x45904f "the test body") at test/gtest/src/gtest.cc:2115
#20 0x0000000000443577 in testing::Test::Run (this=this@entry=0x15f9230)
    at test/gtest/src/gtest.cc:2152
#21 0x0000000000443616 in testing::TestInfo::Run (this=0x15f7e60) at test/gtest/src/gtest.cc:2327
#22 0x000000000044371d in testing::TestCase::Run (this=0x15f82b0) at test/gtest/src/gtest.cc:2445
#23 0x00000000004439ad in testing::internal::UnitTestImpl::RunAllTests (this=0x15f7f20)
    at test/gtest/src/gtest.cc:4316
#24 0x0000000000443cae in HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (location=<optimized out>, 
    method=<optimized out>, object=<optimized out>) at test/gtest/src/gtest.cc:2079
#25 HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (
    location=0x45a598 "auxiliary test code (environments or event listeners)", 
    method=(bool (testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const)) 0x443790 <testing::internal::UnitTestImpl::RunAllTests()>, object=0x15f7f20) at test/gtest/src/gtest.cc:2115
#26 testing::UnitTest::Run (this=<optimized out>) at test/gtest/src/gtest.cc:3930
#27 0x000000000040f9df in RUN_ALL_TESTS () at test/gtest/include/gtest/gtest.h:2288
#28 main (argc=1, argv=<optimized out>) at gazebo/sensors/CameraSensor_TEST.cc:85
osrf-migration commented 8 years ago

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


It seems to be failing consistently on osx:

osrf-migration commented 8 years ago

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


Resolved in pull request #2191

osrf-migration commented 8 years ago

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


osrf-migration commented 8 years ago

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).