Mir

A frozen client can hang the whole server

Bug #1350207 reported by Daniel van Vugt
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mir
Fix Released
Critical
Alexandros Frantzis
0.6
Won't Fix
Undecided
Unassigned
0.7
Fix Released
Critical
Alexandros Frantzis
mir (Ubuntu)
Fix Released
High
Unassigned
mir (Ubuntu RTM)
Fix Released
High
Unassigned

Bug Description

A frozen Mir client can hang the whole server

Test case:
  1. mir_demo_server_shell
  2. mir_demo_client_egltriangle
  3. In the egltriangle terminal window hit Ctrl+S to freeze the terminal output and the client.
  4. Resize the frozen egltriangle window lots (Alt+middlebutton+drag).
  5. Move the mouse around on the server.

Expected: The mouse can still move.
Observed: The mouse is frozen until the client is unfrozen (Ctrl+Q).

The same happens if you stop the client process using normal Unix signals:
    killall -STOP mir_demo_client_egltriangle
The server quickly becomes frozen, until the client is unfrozen with:
    killall -CONT mir_demo_client_egltriangle

Related branches

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

I can't reproduce this, everything works as expected for me, with both Ctrl+Q and SIGSTOP.

Changed in mir:
milestone: 0.6.0 → 0.7.0
Revision history for this message
kevin gunn (kgunn72) wrote :

just tried and could not reproduce several time in a row, triangle was stopped but mouse was able to move

description: updated
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Reproduced again with the latest Mir source. Although today it took more effort so I've updated the test case to give you a better chance of experiencing the freeze. Still trying to get a stack trace. gdb is not cooperating.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Download full text (7.7 KiB)

Predictably, the server is hung when trying to write to the socket with a hung client at the other end. Eventually the socket buffer fills up...

#0 0x00007ffff5c00bfd in poll () at ../sysdeps/unix/syscall-template.S:81
#1 0x00007ffff789d656 in boost::asio::detail::socket_ops::poll_write (s=35,
    state=0 '\000', ec=...)
    at /usr/include/boost/asio/detail/impl/socket_ops.ipp:1819
#2 0x00007ffff789d349 in boost::asio::detail::socket_ops::sync_send (s=35,
    state=82 'R', bufs=0x7fffe6ff9c30, count=1, flags=0, all_empty=false,
    ec=...) at /usr/include/boost/asio/detail/impl/socket_ops.ipp:1174
#3 0x00007ffff789f892 in boost::asio::detail::reactive_socket_service_base::send<boost::asio::detail::consuming_buffers<boost::asio::const_buffer, boost::asio::mutable_buffers_1> > (this=0x6a95b8, impl=..., buffers=..., flags=0, ec=...)
    at /usr/include/boost/asio/detail/reactive_socket_service_base.hpp:184
#4 0x00007ffff789f563 in boost::asio::stream_socket_service<boost::asio::local::stream_protocol>::send<boost::asio::detail::consuming_buffers<boost::asio::const_buffer, boost::asio::mutable_buffers_1> > (this=0x6a9590, impl=...,
    buffers=..., flags=0, ec=...)
    at /usr/include/boost/asio/stream_socket_service.hpp:314
#5 0x00007ffff789eca0 in boost::asio::basic_stream_socket<boost::asio::local::stream_protocol, boost::asio::stream_socket_service<boost::asio::local::stream_protocol> >::write_some<boost::asio::detail::consuming_buffers<boost::asio::const_buffer, boost::asio::mutable_buffers_1> > (this=0x6a83a0, buffers=..., ec=...)
    at /usr/include/boost/asio/basic_stream_socket.hpp:683
#6 0x00007ffff789e1c4 in boost::asio::write<boost::asio::basic_stream_socket<boost::asio::local::stream_protocol, boost::asio::stream_socket_service<boost::asio::local::stream_protocol> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t> (s=..., buffers=..., completion_condition=..., ec=...)
    at /usr/include/boost/asio/impl/write.hpp:49
#7 0x00007ffff789dab8 in boost::asio::write<boost::asio::basic_stream_socket<boost::asio::local::stream_protocol, boost::asio::stream_socket_service<boost::asio::local::stream_protocol> >, boost::asio::mutable_buffers_1> (s=...,
    buffers=...) at /usr/include/boost/asio/impl/write.hpp:62
#8 0x00007ffff789bd92 in mir::frontend::detail::SocketMessenger::send (
    this=0x7fffe0000a30, data=0x7fffe6ffab70 "\032\336\b\n\333\b\n\330\b\003",
    length=1121, fd_set=...)
    at /home/dan/bzr/mir/hang/src/server/frontend/socket_messenger.cpp:80
#9 0x00007ffff78a1077 in mir::frontend::detail::EventSender::send_event_sequence (this=0x7fffe00008d0, seq=...)
    at /home/dan/bzr/mir/hang/src/server/frontend/event_sender.cpp:89
#10 0x00007ffff78a0d5e in mir::frontend::detail::EventSender::handle_event (
    this=0x7fffe00008d0, e=...)
    at /home/dan/bzr/mir/hang/src/server/frontend/event_sender.cpp:49
#11 0x00007ffff794e1b6 in mir::scene::SurfaceEventSource::resized_to (
    this=0x7fffe00016d0, size=...)
    at /home/dan/bzr/mir/hang/src/server/scene/surface_event_source.cpp:45
#12 0x00007ffff7917ab3 in mir::scene::SurfaceObservers::<lambda(const std::shared_ptr<mir::scene::SurfaceObserver>&...

Read more...

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Ha. The hanging function call is:

    // TODO: This should be asynchronous, but we are not making sure
    // that a potential call to send_fds is executed _after_ this
    // function has completed (if it would be executed asynchronously.
    // NOTE: we rely on this synchronous behavior as per the comment in
    // mf::SessionMediator::create_surface
    ba::write(*socket, ba::buffer(whole_message.data(), whole_message.size()));

Changed in mir:
milestone: 0.7.0 → 0.8.0
Revision history for this message
kevin gunn (kgunn72) wrote :

just raising priority as we've cleared out our critical bug list as of late.
good candidate to get priority attention

Changed in mir:
importance: High → Critical
Revision history for this message
kevin gunn (kgunn72) wrote :
Changed in mir:
assignee: nobody → Alexandros Frantzis (afrantzis)
kevin gunn (kgunn72)
Changed in mir:
status: Triaged → In Progress
Changed in mir:
milestone: 0.8.0 → 0.9.0
Changed in mir (Ubuntu):
importance: Undecided → High
status: New → Triaged
Changed in mir:
milestone: 0.9.0 → 0.8.0
no longer affects: mir/0.8
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

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

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

Fix committed to lp:mir/0.7 at revision 1907, scheduled for release in Mir 0.7.3.

Changed in mir:
milestone: 0.7.3 → 0.8.0
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mir - 0.7.3+14.10.20140918.1-0ubuntu1

---------------
mir (0.7.3+14.10.20140918.1-0ubuntu1) utopic; urgency=medium

  [ Andreas Pokorny ]
  * New upstream release 0.7.3 (https://launchpad.net/mir/+milestone/0.7.3)
    - Bug fixes
      . Fix constructor syntax errors (LP: #1369389)
      . server: Workaround for unresponsive clients causing the server to hang
        (LP: #1350207)
      . Relax strict dependencies of graphics drivers on an exact version
        of the libmirplatform2 package. It's blocking CI. (LP: #1370866)
      . Update cmake scripts to current version of gcovr.

  [ Ubuntu daily release ]
  * New rebuild forced
 -- Ubuntu daily release <email address hidden> Thu, 18 Sep 2014 14:54:51 +0000

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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