Bug #2246

Socket Server Deadlock

Added by J. Moringen over 4 years ago. Updated almost 2 years ago.

Status:NewStart date:04/29/2015
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:C++
Target version:rsb-0.18

Description

The program

/vol/toolkit/nightly/trusty/x86_64/2015-04-29_14-35-42/bin/ccalwr_runLWRRaveSimulator 

acts as socket server. Deadlock when one client disconnects while the server receives events from a second client.

The other client could, for example, be

/vol/toolkit/nightly/trusty/x86_64/last/bin/ccalwr_sendLWRRemoteCmd -s /lwr/cmd/all/position --jointPositionStart '-90 -90 -90 -90 -90 -90 -90' --jointPositionEnd "90 90 90 90 90 90 90" --numPoints 10 -R -c500

Connecting and disconnecting can probably be done with any client. The initial experiment used the cl logger.

Thread 1 (Thread 0x7ffff7f9d780 (LWP 19427)):
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007ffff6d13672 in _L_lock_953 () from /lib/x86_64-linux-gnu/libpthread.so.0
#2  0x00007ffff6d134da in __GI___pthread_mutex_lock (mutex=0x7ffed0002870) at ../nptl/pthread_mutex_lock.c:114
#3  0x00007ffff76de9dc in lock (this=<optimized out>) at /usr/include/boost/thread/pthread/recursive_mutex.hpp:110
#4  boost::unique_lock<boost::recursive_mutex>::lock (this=0x7fffffffc800) at /usr/include/boost/thread/lock_types.hpp:346
#5  0x00007fffebf51f9e in unique_lock (m_=..., this=0x7fffffffc800) at /usr/include/boost/thread/lock_types.hpp:124
#6  rsb::transport::socket::BusConnection::sendEvent (this=0x7ffed0002820, event=..., wireSchema=...) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/transport/socket/BusConnection.cpp:141
#7  0x00007fffebf57812 in rsb::transport::socket::Bus::handle (this=0x1044e80, event=...) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/transport/socket/Bus.cpp:217
#8  0x00007fffebf6c180 in rsb::transport::socket::LifecycledBusServer::handle (this=<optimized out>, event=...) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/transport/socket/LifecycledBusServer.cpp:72
#9  0x00007fffebf6d54c in rsb::transport::socket::OutConnector::handle (this=0x10b8930, event=...) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/transport/socket/OutConnector.cpp:96
#10 0x00007fffebf08b89 in rsb::eventprocessing::DirectEventSendingStrategy::process (this=0x10b3f10, event=...) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/eventprocessing/DirectEventSendingStrategy.cpp:59
#11 0x00007fffebf1bd8d in rsb::eventprocessing::OutRouteConfigurator::publish (this=0x10b4cc0, e=...) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/eventprocessing/OutRouteConfigurator.cpp:141
#12 0x00007fffebedddb9 in rsb::InformerBase::uncheckedPublish (this=this@entry=0x10b4c40, event=...) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/Informer.cpp:134
#13 0x00007fffebeddedc in rsb::InformerBase::uncheckedPublish (this=0x10b4c40, data=..., type=...) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/Informer.cpp:95
#14 0x00007ffff744be44 in uncheckedPublish<rci::Pose> (type=..., data=..., this=<optimized out>) at /vol/toolkit/nightly/trusty/x86_64/2015-04-29_14-35-42/include/rsb0.13/rsb/Informer.h:159
#15 cca::OutputPort<rci::Pose>::publish (this=<optimized out>, data=...) at /vol/toolkit/nightly/trusty/x86_64/2015-04-29_14-35-42/include/cca0.5/cca/port/OutputPort.h:92
#16 0x00007ffff744b6dc in cca::lwr::CCALWREndeffector::onProcess (this=0x10ad920) at /home/jenkins/workspace/cca-lwr-trunk-toolkit-citk-nightly/src/cca/lwr/CCALWREndeffector.cpp:62
#17 0x00007ffff718cd32 in cca::Node::process (this=0x10ad920) at /home/jenkins/workspace/cca-trunk-toolkit-citk-nightly/src/cca/Node.cpp:367
#18 0x00007ffff718c434 in cca::Node::tick (this=0x10ad920) at /home/jenkins/workspace/cca-trunk-toolkit-citk-nightly/src/cca/Node.cpp:188
#19 0x00007ffff7183115 in cca::PeriodicBeat::execute (this=0x6483f0) at /home/jenkins/workspace/cca-trunk-toolkit-citk-nightly/src/cca/timing/PeriodicBeat.cpp:58
#20 0x00007ffff7700862 in rsc::threading::RepetitiveTask::run (this=this@entry=0x648430) at /home/jenkins/workspace/rsc-master-toolkit-citk-nightly/src/rsc/threading/RepetitiveTask.cpp:78
#21 0x00007ffff71836fa in cca::PeriodicBeat::run (this=0x6483f0) at /home/jenkins/workspace/cca-trunk-toolkit-citk-nightly/src/cca/timing/PeriodicBeat.cpp:80
#22 0x0000000000411e0c in main (argc=<optimized out>, argv=<optimized out>) at /home/jenkins/workspace/cca-lwr-trunk-toolkit-citk-nightly/bin/runLWRRaveSimulator.cpp:79
Thread 12 (Thread 0x7fffb4705700 (LWP 19452)):
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007ffff6d13672 in _L_lock_953 () from /lib/x86_64-linux-gnu/libpthread.so.0
#2  0x00007ffff6d134da in __GI___pthread_mutex_lock (mutex=0x1044eb8) at ../nptl/pthread_mutex_lock.c:114
#3  0x00007ffff76de9dc in lock (this=<optimized out>) at /usr/include/boost/thread/pthread/recursive_mutex.hpp:110
#4  boost::unique_lock<boost::recursive_mutex>::lock (this=0x7fffb4704570) at /usr/include/boost/thread/lock_types.hpp:346
#5  0x00007fffebf556f6 in unique_lock (m_=..., this=0x7fffb4704570) at /usr/include/boost/thread/lock_types.hpp:124
#6  rsb::transport::socket::Bus::removeConnection (this=this@entry=0x1044e80, connection=...) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/transport/socket/Bus.cpp:145
#7  0x00007fffebf500ef in rsb::transport::socket::BusConnection::performSafeCleanup (this=this@entry=0x7ffed0002820, context=...) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/transport/socket/BusConnection.cpp:161
#8  0x00007fffebf50eed in rsb::transport::socket::BusConnection::handleReadLength (this=0x7ffed0002820, error=..., bytesTransferred=<optimized out>) at /home/jenkins/workspace/rsb-cpp-master-toolkit-citk-nightly/src/rsb/transport/socket/BusConnection.cpp:205
#9  0x00007fffebf54721 in call<boost::shared_ptr<rsb::transport::socket::BusConnection>, boost::system::error_code const, unsigned long> (b2=<synthetic pointer>, b1=..., u=..., this=0x7fffb4704bb8) at /usr/include/boost/bind/mem_fn_template.hpp:271
#10 operator()<boost::shared_ptr<rsb::transport::socket::BusConnection> > (a2=<optimized out>, a1=..., u=..., this=0x7fffb4704bb8) at /usr/include/boost/bind/mem_fn_template.hpp:286
#11 operator()<boost::_mfi::mf2<void, rsb::transport::socket::BusConnection, const boost::system::error_code&, long unsigned int>, boost::_bi::list2<const boost::system::error_code&, long unsigned int const&> > (a=<synthetic pointer>, f=..., this=0x7fffb4704bc8)
    at /usr/include/boost/bind/bind.hpp:392
#12 operator()<boost::system::error_code, long unsigned int> (a2=@0x7fffb4704bb0: 140732388087872, a1=..., this=0x7fffb4704bb8) at /usr/include/boost/bind/bind_template.hpp:102
#13 boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, boost::_bi::bind_t<void, boost::_mfi::mf2<void, rsb::transport::socket::BusConnection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<rsb::transport::socket::BusConnection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >::operator() (this=this@entry=0x7fffb4704c90, 
    ec=..., bytes_transferred=<optimized out>, start=start@entry=0) at /usr/include/boost/asio/impl/read.hpp:282
#14 0x00007fffebf54aa3 in operator() (this=0x7fffb4704c90) at /usr/include/boost/asio/detail/bind_handler.hpp:127
#15 asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, boost::_bi::bind_t<void, boost::_mfi::mf2<void, rsb::transport::socket::BusConnection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<rsb::transport::socket::BusConnection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >, boost::system::error_code, unsigned long> > (
    function=<error reading variable: access outside bounds of object referenced via synthetic pointer>) at /usr/include/boost/asio/handler_invoke_hook.hpp:64
#16 invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, boost::_bi::bind_t<void, boost::_mfi::mf2<void, rsb::transport::socket::BusConnection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<rsb::transport::socket::BusConnection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >, boost::system::error_code, unsigned long>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, rsb::transport::socket::BusConnection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<rsb::transport::socket::BusConnection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > > (context=..., 
    function=...) at /usr/include/boost/asio/detail/handler_invoke_helpers.hpp:37
#17 asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, boost::_bi::bind_t<void, boost::_mfi::mf2<void, rsb::transport::socket::BusConnection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<rsb::transport::socket::BusConnection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >, boost::system::error_code, unsigned long>, boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, boost::_bi::bind_t<void, boost::_mfi::mf2<void, rsb::transport::socket::BusConnection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<rsb::transport::socket::BusConnection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > > (this_handler=0x7fffb4704c30, function=...) at /usr/include/boost/asio/impl/read.hpp:502
#18 invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, boost::_bi::bind_t<void, boost::_mfi::mf2<void, rsb::transport::socket::BusConnection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<rsb::transport::socket::BusConnection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >, boost::system::error_code, unsigned long>, boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, boost::_bi::bind_t<void, boost::_mfi::mf2<void, rsb::transport::socket::BusConnection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<rsb::transport::socket::BusConnection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > > > (context=..., function=...) at /usr/include/boost/asio/detail/handler_invoke_helpers.hpp:37
#19 boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, boost::_bi::bind_t<void, boost::_mfi::mf2<void, rsb::transport::socket::BusConnection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<rsb::transport::socket::BusConnection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > > >::do_complete (owner=0x1043240, base=<optimized out>) at /usr/include/boost/asio/detail/reactive_socket_recv_op.hpp:110
#20 0x00007fffebf2cb3f in complete (bytes_transferred=<optimized out>, ec=..., owner=..., this=0x7ffed0001680) at /usr/include/boost/asio/detail/task_io_service_operation.hpp:37
#21 do_run_one (ec=..., this_thread=..., lock=..., this=0x1043240) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:384
#22 boost::asio::detail::task_io_service::run (this=0x1043240, ec=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:153
#23 0x00007fffebf2cd46 in boost::asio::io_service::run (this=0x10426c0) at /usr/include/boost/asio/impl/io_service.ipp:59
#24 0x00007ffff6f32a4a in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0
#25 0x00007ffff6d11182 in start_thread (arg=0x7fffb4705700) at pthread_create.c:312
#26 0x00007ffff60b247d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

History

#1 Updated by J. Moringen over 4 years ago

  • Description updated (diff)

#2 Updated by J. Wienke over 4 years ago

Do you understand this deadlock? To me this looks like two completely different mutexes being involved.

#3 Updated by J. Moringen over 4 years ago

I haven't looked at it at all. All other threads seemed to be uninteresting, though. So the deadlock should be here.

#4 Updated by J. Moringen over 4 years ago

  • Description updated (diff)

#5 Updated by J. Moringen over 3 years ago

  • Target version changed from rsb-0.13 to rsb-0.14

#6 Updated by J. Moringen about 3 years ago

  • Target version changed from rsb-0.14 to rsb-0.15

#7 Updated by J. Moringen almost 3 years ago

  • Target version changed from rsb-0.15 to rsb-0.16

#8 Updated by J. Moringen over 2 years ago

  • Target version changed from rsb-0.16 to rsb-0.17

#9 Updated by J. Moringen almost 2 years ago

  • Target version changed from rsb-0.17 to rsb-0.18

Also available in: Atom PDF