Merge lp://staging/~aacid/qtmir/fixAuthorizeDeadlock into lp://staging/qtmir
Status: | Merged |
---|---|
Approved by: | Gerry Boland |
Approved revision: | 623 |
Merged at revision: | 628 |
Proposed branch: | lp://staging/~aacid/qtmir/fixAuthorizeDeadlock |
Merge into: | lp://staging/qtmir |
Prerequisite: | lp://staging/~aacid/qtmir/remove_non_interface_things |
Diff against target: |
607 lines (+133/-75) 6 files modified
src/modules/Unity/Application/application.cpp (+0/-27) src/modules/Unity/Application/application.h (+0/-4) src/modules/Unity/Application/application_manager.cpp (+120/-36) src/modules/Unity/Application/application_manager.h (+12/-0) src/modules/Unity/Application/taskcontroller.cpp (+1/-6) src/modules/Unity/Application/taskcontroller.h (+0/-2) |
To merge this branch: | bzr merge lp://staging/~aacid/qtmir/fixAuthorizeDeadlock |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gerry Boland (community) | Approve | ||
Unity8 CI Bot (community) | continuous-integration | Approve | |
Review via email: mp+320614@code.staging.launchpad.net |
Commit message
Run ApplicationMana
Instead of using a BlockingQueuedC
This fixes the deadlock we have when we are creating a player that uses gstreamer and
gstreamer needs to update its registry (which blocks waiting for an external process to finish)
and that external process tries to connect to mir.
Adds a QMutex in ApplicationManager that protects the public functions and slots
The mutex needs to be recursive since for example beginInsertRows call in add() will call rowCount()
The setPid/addApp functions are still run through a queued signal so that the model/QObjects are still all handled in the main thread.
findApplication
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
No
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
There is one code path I'm concerned about here, which is when an app is launched by UAL directly (say via command line, or url dispatcher) - so AppMan: :startApplicati on wasn't called.
Ubuntu-app-launch library causes the TaskController: :processStartin g signal to be emitted. I *think* this happens on an internal UAL thread. So the slot ApplicationMana ger::onProcessS tarting will be called as a queued event.
Then before this MP, TaskController: :authorizationR equestedForSess ion signal is fired from a Mir thread, causing the slot AppMan: :authorizeSessi on to also be queued event.
This ensures the order of execution in AppMan is always first onProcessStarting, second authorizeSession. If the order is wrong, authoriseSession will reject the app (because UAL hadn't told it to expect it yet).
My worry is if UAL launched a super fast app, it would be possible for this sequence of events to occur: :processStartin g signal emitted :authorizationR equestedForSess ion signal emitted
- TaskController:
- TaskController:
- authorizeSession (called Direct)
- onProcessStarting (called Queued)
causing the app to be rejected.
Unfortunately I can't point you to an easy way to reproduce this. I can try constructing a test to prove/disprove my worry here, if you'd like.