Mir

helgrind: Lock order violated (potential deadlock) in ConnectionSurfaceMap

Bug #1243576 reported by Daniel van Vugt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mir
Fix Released
Medium
Alan Griffiths
mir (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

helgrind: Lock order violated (potential deadlock) in ConnectionSurfaceMap

==21606== ----------------------------------------------------------------
==21606==
==21606== Thread #2: lock order "0x9267668 before 0x9258A30" violated
==21606==
==21606== Observed (incorrect) order is: acquisition of lock at 0x9258A30
==21606== at 0x4C2FC35: pthread_mutex_lock (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==21606== by 0x4F9EB21: __gthread_mutex_lock(pthread_mutex_t*) (gthr-default.h:748)
==21606== by 0x4F9F171: std::mutex::lock() (mutex:134)
==21606== by 0x4FAFE86: std::unique_lock<std::mutex>::lock() (mutex:511)
==21606== by 0x4FAFC30: std::unique_lock<std::mutex>::unique_lock(std::mutex&) (mutex:443)
==21606== by 0x4FC1665: mir::client::ConnectionSurfaceMap::with_surface_do(int const&, std::function<void (MirSurface*)>) (surface_map.cpp:32)
==21606== by 0x4FD1CAA: mir::client::rpc::MirSocketRpcChannel::process_event_sequence(std::string const&) (mir_socket_rpc_channel.cpp:423)
==21606== by 0x4FD1908: mir::client::rpc::MirSocketRpcChannel::read_message() (mir_socket_rpc_channel.cpp:367)
==21606== by 0x4FD1745: mir::client::rpc::MirSocketRpcChannel::on_header_read(boost::system::error_code const&) (mir_socket_rpc_channel.cpp:335)
==21606== by 0x4FE4C15: boost::_mfi::mf1<void, mir::client::rpc::MirSocketRpcChannel, boost::system::error_code const&>::operator()(mir::client::rpc::MirSocketRpcChannel*, boost::system::error_code const&) const (mem_fn_template.hpp:165)
==21606== by 0x4FE3A0F: void boost::_bi::list2<boost::_bi::value<mir::client::rpc::MirSocketRpcChannel*>, boost::arg<1> (*)()>::operator()<boost::_mfi::mf1<void, mir::client::rpc::MirSocketRpcChannel, boost::system::error_code const&>, boost::_bi::list2<boost::system::error_code const&, unsigned long const&> >(boost::_bi::type<void>, boost::_mfi::mf1<void, mir::client::rpc::MirSocketRpcChannel, boost::system::error_code const&>&, boost::_bi::list2<boost::system::error_code const&, unsigned long const&>&, int) (bind.hpp:313)
==21606== by 0x4FE1F0F: void boost::_bi::bind_t<void, boost::_mfi::mf1<void, mir::client::rpc::MirSocketRpcChannel, boost::system::error_code const&>, boost::_bi::list2<boost::_bi::value<mir::client::rpc::MirSocketRpcChannel*>, boost::arg<1> (*)()> >::operator()<boost::system::error_code, unsigned long>(boost::system::error_code const&, unsigned long const&) (bind_template.hpp:102)
==21606==
==21606== followed by a later acquisition of lock at 0x9267668
==21606== at 0x4C2FC35: pthread_mutex_lock (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==21606== by 0x4FA9205: __gthread_mutex_lock(pthread_mutex_t*) (gthr-default.h:748)
==21606== by 0x4FA9255: __gthread_recursive_mutex_lock(pthread_mutex_t*) (gthr-default.h:810)
==21606== by 0x4FAB8BB: std::recursive_mutex::lock() (mutex:175)
==21606== by 0x4FB3A78: std::unique_lock<std::recursive_mutex>::lock() (mutex:511)
==21606== by 0x4FB2FFC: std::unique_lock<std::recursive_mutex>::unique_lock(std::recursive_mutex&) (mutex:443)
==21606== by 0x4FB1DE0: MirSurface::handle_event(MirEvent const&) (mir_surface.cpp:371)
==21606== by 0x4FD1A91: mir::client::rpc::MirSocketRpcChannel::process_event_sequence(std::string const&)::{lambda(MirSurface*)#1}::operator()(MirSurface*) const (mir_socket_rpc_channel.cpp:422)
==21606== by 0x4FD2430: std::_Function_handler<void (MirSurface*), mir::client::rpc::MirSocketRpcChannel::process_event_sequence(std::string const&)::{lambda(MirSurface*)#1}>::_M_invoke(std::_Any_data const&, MirSurface*) (functional:2071)
==21606== by 0x4FC1B7A: std::function<void (MirSurface*)>::operator()(MirSurface*) const (functional:2464)
==21606== by 0x4FC16F3: mir::client::ConnectionSurfaceMap::with_surface_do(int const&, std::function<void (MirSurface*)>) (surface_map.cpp:37)
==21606== by 0x4FD1CAA: mir::client::rpc::MirSocketRpcChannel::process_event_sequence(std::string const&) (mir_socket_rpc_channel.cpp:423)
==21606==
==21606== Required order was established by acquisition of lock at 0x9267668
==21606== at 0x4C2FC35: pthread_mutex_lock (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==21606== by 0x4FA9205: __gthread_mutex_lock(pthread_mutex_t*) (gthr-default.h:748)
==21606== by 0x4FA9255: __gthread_recursive_mutex_lock(pthread_mutex_t*) (gthr-default.h:810)
==21606== by 0x4FAB8BB: std::recursive_mutex::lock() (mutex:175)
==21606== by 0x4FAC37D: std::lock_guard<std::recursive_mutex>::lock_guard(std::recursive_mutex&) (mutex:414)
==21606== by 0x4FB1197: MirSurface::created(void (*)(MirSurface*, void*), void*) (mir_surface.cpp:197)
==21606== by 0x4FB5734: google::protobuf::internal::MethodClosure2<MirSurface, void (*)(MirSurface*, void*), void*>::Run() (common.h:969)
==21606== by 0x4FD0EBD: mir::client::rpc::MirSocketRpcChannel::receive_file_descriptors(google::protobuf::Message*, google::protobuf::Closure*) (mir_socket_rpc_channel.cpp:211)
==21606== by 0x4FE7136: google::protobuf::internal::MethodClosure2<mir::client::rpc::MirSocketRpcChannel, google::protobuf::Message*, google::protobuf::Closure*>::Run() (common.h:969)
==21606== by 0x4FE7D08: mir::client::rpc::detail::PendingCallCache::complete_response(mir::protobuf::wire::Result&) (mir_basic_rpc_channel.cpp:69)
==21606== by 0x4FD195B: mir::client::rpc::MirSocketRpcChannel::read_message() (mir_socket_rpc_channel.cpp:372)
==21606== by 0x4FD1745: mir::client::rpc::MirSocketRpcChannel::on_header_read(boost::system::error_code const&) (mir_socket_rpc_channel.cpp:335)
==21606==
==21606== followed by a later acquisition of lock at 0x9258A30
==21606== at 0x4C2FC35: pthread_mutex_lock (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==21606== by 0x4F9EB21: __gthread_mutex_lock(pthread_mutex_t*) (gthr-default.h:748)
==21606== by 0x4F9F171: std::mutex::lock() (mutex:134)
==21606== by 0x4FAFE86: std::unique_lock<std::mutex>::lock() (mutex:511)
==21606== by 0x4FAFC30: std::unique_lock<std::mutex>::unique_lock(std::mutex&) (mutex:443)
==21606== by 0x4FC1869: mir::client::ConnectionSurfaceMap::insert(int const&, MirSurface*) (surface_map.cpp:52)
==21606== by 0x4FAB16F: MirConnection::on_surface_created(int, MirSurface*) (mir_connection.cpp:397)
==21606== by 0x4FB122D: MirSurface::created(void (*)(MirSurface*, void*), void*) (mir_surface.cpp:204)
==21606== by 0x4FB5734: google::protobuf::internal::MethodClosure2<MirSurface, void (*)(MirSurface*, void*), void*>::Run() (common.h:969)
==21606== by 0x4FD0EBD: mir::client::rpc::MirSocketRpcChannel::receive_file_descriptors(google::protobuf::Message*, google::protobuf::Closure*) (mir_socket_rpc_channel.cpp:211)
==21606== by 0x4FE7136: google::protobuf::internal::MethodClosure2<mir::client::rpc::MirSocketRpcChannel, google::protobuf::Message*, google::protobuf::Closure*>::Run() (common.h:969)
==21606== by 0x4FE7D08: mir::client::rpc::detail::PendingCallCache::complete_response(mir::protobuf::wire::Result&) (mir_basic_rpc_channel.cpp:69)
==21606==
==21606== ----------------------------------------------------------------

Tags: helgrind

Related branches

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

It would be useful to know which program generated the above trace

Changed in mir:
assignee: nobody → Alan Griffiths (alan-griffiths)
Changed in mir:
status: New → In Progress
Changed in mir:
milestone: none → 0.1.4
tags: added: helgrind
Changed in mir:
status: In Progress → Triaged
Changed in mir:
status: Triaged → In Progress
Changed in mir:
importance: Undecided → Critical
importance: Critical → Medium
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:mir/devel at revision 1316, scheduled for release in mir, milestone Unknown

Changed in mir:
status: In Progress → Fix Committed
Changed in mir:
status: Fix Committed → Fix Released
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

mir (0.1.4+14.04.20140204-0ubuntu1) trusty; urgency=medium

Changed in mir (Ubuntu):
importance: Undecided → Medium
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.