SessionMediator locks mutexes in one thread and unlocks them in another

Bug #1427976 reported by Alberto Aguirre on 2015-03-04
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Alberto Aguirre
Fix Released
Alberto Aguirre
mir (Ubuntu)

Bug Description

SessionMediator locks mutexes in one thread and unlocks them in another thread during create_surface or exchange_buffer. This can cause undefined behavior:


"If the mutex is not currently locked by the calling thread, it causes undefined behavior."

This may potentially be the root cause of a hang (wait handle never signals) seen when creating/destroying menu surfaces while a parent does swap_buffers.

Related branches

Daniel van Vugt (vanvugt) wrote :

I noticed this when hacking exchange_buffer in the past. It always looked concerning to me.

But the question is not whether a locked mutex is portable between threads (because it's not). The question is rather: is the implementation of the *lock template portable between threads? It might be...

Cemil Azizoglu (cemil-azizoglu) wrote :

Does this bug affect rtm or ubuntu? If so, sounds like a perfect candidate for vivid.

Changed in mir:
importance: Undecided → High
Changed in mir:
status: New → In Progress
Alberto Aguirre (albaguirre) wrote :


std::unique_lock is not portable across threads (i.e. it has the same lock/unlock semantics as the mutex it wraps).

Alberto Aguirre (albaguirre) wrote :


Yeah, this also applies to mir/0.8 and mir/ubuntu

PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:mir at revision None, scheduled for release in mir, milestone 0.13.0

Changed in mir:
status: In Progress → Fix Committed
Changed in mir (Ubuntu):
importance: Undecided → High
status: New → Triaged
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mir - 0.12.1+15.04.20150324-0ubuntu1

mir (0.12.1+15.04.20150324-0ubuntu1) vivid; urgency=medium

  [ Alexandros Frantzis ]
  * New upstream release 0.12.1 (https://launchpad.net/mir/+milestone/0.12.1)
    - Bug fixes:
      . [regression] mali, powervr locks up with around the introduction or
        removal of a third overlay (LP: #1413211)
      . USC - mouse cursor on AMD graphics is drawing incorrectly
        (LP: #1417581)
      . mir_demo_server doesn't emit hover_exit events (LP: #1418569)
      . SessionMediator locks mutexes in one thread and unlocks them in
        another (LP: #1427976)
      . ProtobufResponder::send_response_result race (LP: #1428402)
      . Some protobuf Closure objects can access dead objects (LP: #1433330)
      . DisplayConfigurationOutput.physical_size_mm is undefined/zero
        (LP: #1430315)
      . vivid fails to build Mir as of 2015-03-22: error: #warning
        "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
        [-Werror=cpp] (LP: #1435127)
      . valgrind on armhf fails with with many errors (LP: #1435186)
 -- CI Train Bot <email address hidden> Tue, 24 Mar 2015 16:09:54 +0000

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

Other bug subscribers