Mir

Merge lp:~raof/mir/no-ipc-on-compositor-threads into lp:mir

Proposed by Chris Halse Rogers on 2017-07-05
Status: Merged
Approved by: Alan Griffiths on 2017-08-16
Approved revision: 4236
Merged at revision: 4228
Proposed branch: lp:~raof/mir/no-ipc-on-compositor-threads
Merge into: lp:mir
Prerequisite: lp:~raof/mir/better-buffer-plumbing
Diff against target: 1038 lines (+399/-182)
18 files modified
include/server/mir/frontend/buffer_stream.h (+0/-5)
src/server/compositor/dropping_schedule.cpp (+0/-10)
src/server/compositor/dropping_schedule.h (+0/-2)
src/server/compositor/queueing_schedule.cpp (+0/-7)
src/server/compositor/queueing_schedule.h (+0/-2)
src/server/compositor/schedule.h (+0/-3)
src/server/compositor/stream.cpp (+1/-33)
src/server/compositor/stream.h (+0/-5)
src/server/frontend/default_ipc_factory.cpp (+186/-1)
src/server/frontend/default_ipc_factory.h (+4/-0)
src/server/frontend/published_socket_connector.cpp (+50/-10)
src/server/frontend/published_socket_connector.h (+1/-1)
src/server/frontend/session_mediator.cpp (+47/-21)
src/server/frontend/session_mediator.h (+6/-1)
tests/include/mir/test/doubles/stub_buffer_stream.h (+0/-2)
tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp (+0/-6)
tests/unit-tests/compositor/test_queueing_schedule.cpp (+0/-19)
tests/unit-tests/frontend/test_session_mediator.cpp (+104/-54)
To merge this branch: bzr merge lp:~raof/mir/no-ipc-on-compositor-threads
Reviewer Review Type Date Requested Status
Alan Griffiths 2017-07-05 Approve on 2017-08-16
Mir CI Bot continuous-integration Approve on 2017-08-16
Review via email: mp+326827@code.launchpad.net

Commit message

Move buffer-release IPC to a dedicated IPC thread.

Fixes: LP: #1395421

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4212
https://mir-jenkins.ubuntu.com/job/mir-ci/3474/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4747/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4905
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4894
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4894
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4894
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4784
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4784/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4784
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4784/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4784
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4784/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4784/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4784
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4784/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4784
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4784/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4784
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4784/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4784/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3474/rebuild

review: Needs Fixing (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4216
https://mir-jenkins.ubuntu.com/job/mir-ci/3478/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4751/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4909
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4898
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4898
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4898
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4788
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4788/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4788
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4788/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4788/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4788
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4788/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4788
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4788/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4788
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4788/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4788
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4788/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4788
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4788/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3478/rebuild

review: Needs Fixing (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4216
https://mir-jenkins.ubuntu.com/job/mir-ci/3480/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4753/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4911
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4900
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4900
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4900
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4790
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4790/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4790
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4790/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4790
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4790/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4790
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4790/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4790/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4790
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4790/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4790
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4790/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4790
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4790/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3480/rebuild

review: Needs Fixing (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4217
https://mir-jenkins.ubuntu.com/job/mir-ci/3481/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4756
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4914
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4903
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4903
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4903
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4793
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4793/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4793
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4793/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4793
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4793/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4793
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4793/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4793
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4793/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4793
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4793/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4793
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4793/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4793
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4793/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3481/rebuild

review: Approve (continuous-integration)
Chris Halse Rogers (raof) wrote :

Ok. It's not clear to me how it was deadlocking, and I still can't reproduce this locally, so I'm going to hit rebuild on that. It *seems* that CI pretty reliably hits this, but let's check that it's not a fluke pass.

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4217
https://mir-jenkins.ubuntu.com/job/mir-ci/3482/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4757
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4915
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4904
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4904
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4904
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4794
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4794/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4794
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4794/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4794
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4794/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4794
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4794/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4794
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4794/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4794
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4794/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4794
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4794/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4794
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4794/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3482/rebuild

review: Approve (continuous-integration)
Chris Halse Rogers (raof) wrote :

OK. So looks like that's good.

Alan Griffiths (alan-griffiths) wrote :

Thanks for this - it's been on my to-tidy list far too long.

I'll withhold final approval until we've fixed the pre-requisite.

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4218
https://mir-jenkins.ubuntu.com/job/mir-ci/3497/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4778
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4950
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4939
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4939
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4939
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4815
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4815/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4815
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4815/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4815
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4815/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4815
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4815/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4815
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4815/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4815
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4815/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4815
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4815/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4815
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4815/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3497/rebuild

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

OK

review: Approve
Alan Griffiths (alan-griffiths) wrote :

Hmm, with more testing this may not be working right

review: Abstain
Alan Griffiths (alan-griffiths) wrote :

> Hmm, with more testing this may not be working right

Sorry not to be clear. Hitting EOD.

I tried building miral against this, running miral-app hosted by mir_demo_server and running all the clients.

When I came to close things down things were hung.

Didn't get time to be more specific.

Chris Halse Rogers (raof) wrote :

Moar testing time! Thanks.

Chris Halse Rogers (raof) wrote :

Hm.

To be clear, this is miral-shell hanging if the underlying mir_demo_server goes away (such as by SIGINT)?

If I quit miral-shell first everything seems to go as expected.

Chris Halse Rogers (raof) wrote :

Oh, huh. Looks like it might be any EGL-using client...

Alan Griffiths (alan-griffiths) wrote :

> Hm.
>
> To be clear, this is miral-shell hanging if the underlying mir_demo_server
> goes away (such as by SIGINT)?
>
> If I quit miral-shell first everything seems to go as expected.

No. I was just closing individual clients with Alt-F4 (or Alt-Shift-F4 for the few that don't listen).

I'll try to reproduce and narrow down exactly what went on. And check that it was actually this MP (and not something we already landed).

Chris Halse Rogers (raof) wrote :

Hm. New hypothesis: this has always been broken, and doesn't require nesting.

It seems that if you start up any fullscreen client (tested with eglplasma and _target) before the throbber has finished then the throbber client hangs in swapbuffers and prevents miral-shell shutdown.

This also happens with the archive mir and miral.

Alan Griffiths (alan-griffiths) wrote :

OK, I can't reproduce what I saw yesterday.

Maybe I hit an intermittent, maybe I had screwed up my test. Either way, let's land this and monitor.

review: Approve
Alan Griffiths (alan-griffiths) wrote :

> Hm. New hypothesis: this has always been broken, and doesn't require nesting.
>
> It seems that if you start up any fullscreen client (tested with eglplasma and
> _target) before the throbber has finished then the throbber client hangs in
> swapbuffers and prevents miral-shell shutdown.

"throbber"?

> This also happens with the archive mir and miral.

File a bug. We should fix it.

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/1358/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4783/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/1462/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4956
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4945
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4945
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4945
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4820
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4820/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4820
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4820/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4820
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4820/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4820/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4820
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4820/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4820
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4820/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4820
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4820/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4820
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4820/artifact/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

I don't think the failure is related.

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/1359/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4786/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/1464/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4960
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4949
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4949
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4949
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4823
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4823/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4823/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4823
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4823/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4823
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4823/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4823
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4823/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4823
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4823/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4823
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4823/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4823/console

review: Needs Fixing (continuous-integration)
Chris Halse Rogers (raof) wrote :

On Thu, Jul 20, 2017 at 6:44 PM, Alan Griffiths <email address hidden>
wrote:
>> Hm. New hypothesis: this has always been broken, and doesn't
>> require nesting.
>>
>> It seems that if you start up any fullscreen client (tested with
>> eglplasma and
>> _target) before the throbber has finished then the throbber client
>> hangs in
>> swapbuffers and prevents miral-shell shutdown.
>
> "throbber"?

The splashscreen, spinning Ubuntu logo thingy.

Chris Halse Rogers (raof) wrote :

Hm. *Those* failures are due to real-time tests exceeding their thresholds. This branch plausibly increases the latency of those tests, as the buffer responses now require a context-switch rather than occurring on the compositor thread.

It might also just have been due to a transient load on the CI machine, so I'll give it another try...

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/1362/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4789/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/1467/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4964
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4953
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4953
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4953
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4826
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4826/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4826
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4826/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4826/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4826
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4826/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4826
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4826/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4826
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4826/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4826
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4826/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4826
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4826/artifact/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Chris Halse Rogers (raof) wrote :

(Spinner bug is bug #1705973)

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4218
https://mir-jenkins.ubuntu.com/job/mir-ci/3505/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4795
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4972
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4961
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4961
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4961
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4832
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4832/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4832
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4832/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4832
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4832/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4832
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4832/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4832
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4832/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4832
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4832/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4832
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4832/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4832
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4832/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3505/rebuild

review: Approve (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/1364/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4796/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/1469/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4973
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4962
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4962
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4962
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4833/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4833
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4833/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4833
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4833/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4833
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4833/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4833
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4833/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4833
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4833/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4833
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4833/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4833
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4833/artifact/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

While this could change timing, I don't see why it should affect NestedServer.given_client_set_display_configuration_when_monitor_unplugs_client_can_set_display_configuration

Logged failure as lp:1706050 & re-approved

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/1365/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4798/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/1470/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4976
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4965
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4965
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4965
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4835
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4835/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4835
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4835/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4835
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4835/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4835
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4835/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4835
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4835/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4835
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4835/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4835
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4835/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4835/console

review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

Now a failure in NestedServer.display_orientation_changes_are_forwarded_to_host

...
12:28:26 terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::logic_error> >'
12:28:26 what(): stop_server() failed to stop server
12:28:26 ==18875==
12:28:26 ==18875== Process terminating with default action of signal 6 (SIGABRT)
12:28:26 ==18875== at 0x458AEA9: raise (raise.c:54)
12:28:26 ==18875== by 0x458C406: abort (abort.c:89)
12:28:26 ==18875== by 0x4420D34: __gnu_cxx::__verbose_terminate_handler() (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.21)
12:28:26 ==18875== by 0x441E832: ??? (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.21)
12:28:26 ==18875== by 0x441D648: ??? (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.21)
12:28:26 ==18875== by 0x441DE10: __gxx_personality_v0 (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.21)
12:28:26 ==18875== by 0x453A3DE: ??? (in /lib/i386-linux-gnu/libgcc_s.so.1)
12:28:26 ==18875== by 0x453A856: _Unwind_Resume (in /lib/i386-linux-gnu/libgcc_s.so.1)
12:28:26 ==18875== by 0x8727D93: ~unique_lock (mutex:450)
12:28:26 ==18875== by 0x8727D93: mir_test_framework::AsyncServerRunner::wait_for_server_exit() (async_server_runner.cpp:117)
...

I think that's (at least) a failure too many to be a coincidence.

Is this MP introducing a shutdown race that can deadlock?

review: Needs Information
Chris Halse Rogers (raof) wrote :

I cannot for the life of me get this to fail locally.

I've run “make test” on a valgrind and debflags build in a loop for hours, and the tests continue to reliably pass.

Aaargh.

Here are some changes which also don't fail locally, but might help?

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4220
https://mir-jenkins.ubuntu.com/job/mir-ci/3507/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4800
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4982
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4971
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4971
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4971
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4837
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4837/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4837
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4837/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4837
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4837/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4837
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4837/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4837
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4837/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4837
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4837/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4837
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4837/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4837
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4837/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3507/rebuild

review: Approve (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4223
https://mir-jenkins.ubuntu.com/job/mir-ci/3508/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4801
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4983
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4972
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4972
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4972
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4838
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4838/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4838
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4838/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4838
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4838/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4838
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4838/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4838
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4838/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4838
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4838/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4838
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4838/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4838
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4838/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3508/rebuild

review: Approve (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4225
https://mir-jenkins.ubuntu.com/job/mir-ci/3512/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4807/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4994
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4983
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4983
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4983
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4844
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4844/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4844
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4844/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4844/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4844
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4844/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4844/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4844
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4844/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4844
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4844/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4844/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3512/rebuild

review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

Just looking at the last commit:

1. Do we really want four shared pointers in ThreadExecutor? Surely one pointer holding a "shared state" implementation object would be better?

2. The (potential) problem with detaching threads is ensuring they exit before the process does. I don't see this being a problem here except possibly with valgrind...

Chris Halse Rogers (raof) wrote :

It shouldn't matter if the threads don't end before the process does; valgrind doesn't count reachable objects as leaked, and if the thread hasn't finished then the objects are still reachable.

This should now *actually* work.

I'm somewhat surprised we haven't seen problems caused by the boost::...::socket outliving the io_service in the past. As far as I can tell, there's no mechanism to enforce that - we share SocketMessangers around pretty widely...

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4227
https://mir-jenkins.ubuntu.com/job/mir-ci/3518/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4814
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5012
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5001
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5001
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5001
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4851
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4851/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4851
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4851/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4851
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4851/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4851
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4851/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4851
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4851/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4851
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4851/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4851
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4851/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4851
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4851/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3518/rebuild

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

It still feels untidy to exit while a detached thread might own resources, but that's probably less evil than the existing code.

review: Approve
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/1370/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4816/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/1484/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5014
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5003
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5003
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5003
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4853/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4853/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4853
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4853/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4853
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4853/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4853
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4853/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4853
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4853/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4853
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4853/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4853
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4853/artifact/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

Hmm, this does look suspicious:

10:37:22 9: ==28377== 792 (24 direct, 768 indirect) bytes in 1 blocks are definitely lost in loss record 36 of 41
10:37:22 9: ==28377== at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
10:37:22 9: ==28377== by 0x51B754A: _S_make_state<std::_Bind_simple<(lambda at /<<BUILDDIR>>/mir-0.27.0+artful5003bzr4227/src/server/frontend/default_ipc_factory.cpp:59:13) ()> > (thread:208)
10:37:22 9: ==28377== by 0x51B754A: thread<(lambda at /<<BUILDDIR>>/mir-0.27.0+artful5003bzr4227/src/server/frontend/default_ipc_factory.cpp:59:13)> (thread:137)

review: Needs Fixing
Chris Halse Rogers (raof) wrote :

Damnit, valgrind!

4228. By Chris Halse Rogers on 2017-08-01

*Another* stab at executor shutdown without deadlocks.

The C++ Executor proposal pervasively uses references to Executors rather than
owned executors, and provides the system_executor which has a lifetime that just
exceeds main().

This nicely resolves the deadlock involved with the Executor being destroyed while
a lock is held, due to shared_ptr<> destruction at an unexpected point, while still
ensuring that the Executor thread is destroyed before program exit, thus appeasing
Valgrind (and also anyone dlopen()ing Mir).

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4228
https://mir-jenkins.ubuntu.com/job/mir-ci/3520/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4817/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5018
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5007
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5007
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5007
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4854/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4854/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4854/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4854/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4854/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4854
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4854/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4854
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4854/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4854/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3520/rebuild

review: Needs Fixing (continuous-integration)
Chris Halse Rogers (raof) wrote :

Oh, dear.

This is now running into poor interactions with fork(); specifically:
Specifically:
       * After a fork() in a multithreaded program, the child can safely
          call only async-signal-safe functions (see signal-safety(7)) until
          such time as it calls execve(2).

When running “make test”, we've got a single process executing all the tests; since the ThreadExecutor is now static, we now have a thread waiting around before we get to fork().

This is why ptest doesn't fail; each test gets its own process...

Alan Griffiths (alan-griffiths) wrote :

> Oh, dear.
>
> This is now running into poor interactions with fork(); specifically:
> Specifically:
> * After a fork() in a multithreaded program, the child can safely
> call only async-signal-safe functions (see signal-safety(7)) until
> such time as it calls execve(2).
>
> When running “make test”, we've got a single process executing all the tests;
> since the ThreadExecutor is now static, we now have a thread waiting around
> before we get to fork().

Ack. Objects with static duration can be problematic. :(

> This is why ptest doesn't fail; each test gets its own process...

I'm not convinced by that final reasoning: with ptest each test fixture gets its own process, but that still runs multiple tests (each of which may fork).

Chris Halse Rogers (raof) wrote :

On 2 August 2017 6:03:59 pm AEST, Alan Griffiths <email address hidden> wrote:
>> This is why ptest doesn't fail; each test gets its own process...
>
>I'm not convinced by that final reasoning: with ptest each test fixture
>gets its own process, but that still runs multiple tests (each of which
>may fork).

More correctly: our tests that fork do so *first*, and do all of their multi-threading in a child.

Then along comes this MP, and causes a thread to hang around - waiting on a condition variable - from a previous test. Now our top-level fork is mt.

A hack - delete and recreate the executor across fork boundaries using pthread_atfork() - resolves this. It should also work to quiesce the executor pre-fork and then resume it in the other end.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

4229. By Chris Halse Rogers on 2017-08-03

ThreadExectuor: Oh my god, the bees!

Static storage duration of something containing std::mutex and std::condition_variable plays badly
with fork(), such as our esteemed testsuite uses.

It's also possible that Mir shells would fork() under certain circumstances, and it'd be nice if
we didn't make that break horribly.

So: register a pthread_atfork handler to quiesce the ThreadExecutor into a known-safe idle state,
and then restart it on the other side of the fork.

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4229
https://mir-jenkins.ubuntu.com/job/mir-ci/3524/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4822/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5023
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5012
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5012
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5012
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4859/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4859/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4859/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4859/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4859/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4859
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4859/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4859
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4859/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4859
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4859/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3524/rebuild

review: Needs Fixing (continuous-integration)
4230. By Chris Halse Rogers on 2017-08-03

ThreadExecutor: Set state to Running before releasing the lock when spawning the thread.

Otherwise we *could* race and try to create the thread twice.

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4230
https://mir-jenkins.ubuntu.com/job/mir-ci/3525/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4824/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5025
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5014
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5014
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5014
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4861/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4861
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4861/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4861/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4861
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4861/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4861
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4861/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4861
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4861/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4861
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4861/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4861
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4861/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3525/rebuild

review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

Just artful/amd64/[g++|clang]?

That's also happening in two other branches. (I've reproduced locally yet.)

Alan Griffiths (alan-griffiths) wrote :

> Just artful/amd64/[g++|clang]?
>
> That's also happening in two other branches. (I've reproduced locally yet.)

I've *not* reproduced locally yet.

Chris Halse Rogers (raof) wrote :

Yeah. *My* artful builds work fine!

Alan Griffiths (alan-griffiths) wrote :

Hmm, the errors seem to be coming from DefaultPersistentSurfaceStore's unordered_map - and I see no synchronization primitives. Could this be accessed from multiple threads?

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4231
https://mir-jenkins.ubuntu.com/job/mir-ci/3531/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4830/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5031
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5020
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5020
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5020
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4867/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4867
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4867/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4867/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4867
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4867/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4867
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4867/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4867
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4867/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4867
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4867/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4867
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4867/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3531/rebuild

review: Needs Fixing (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4232
https://mir-jenkins.ubuntu.com/job/mir-ci/3532/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4831/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5032
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5021
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5021
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5021
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4868/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4868/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4868/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4868/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4868/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4868/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4868/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4868/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3532/rebuild

review: Needs Fixing (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4233
https://mir-jenkins.ubuntu.com/job/mir-ci/3533/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4832/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5033
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5022
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5022
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5022
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4869/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4869
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4869/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4869/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4869
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4869/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4869
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4869/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4869
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4869/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4869
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4869/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4869
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4869/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3533/rebuild

review: Needs Fixing (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4234
https://mir-jenkins.ubuntu.com/job/mir-ci/3534/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4833/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5034
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5023
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5023
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5023
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4870/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4870
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4870/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4870/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4870
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4870/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4870
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4870/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4870
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4870/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4870
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4870/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4870
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4870/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3534/rebuild

review: Needs Fixing (continuous-integration)
4231. By Chris Halse Rogers on 2017-08-08

Merge trunk to fix CI build

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4231
https://mir-jenkins.ubuntu.com/job/mir-ci/3543/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4848/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5049
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5038
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5038
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5038
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4885
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4885/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4885
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4885/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4885
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4885/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4885
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4885/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4885
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4885/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4885
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4885/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4885
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4885/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4885/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3543/rebuild

review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

+mir::Executor& system_executor()
+{
+ static std::once_flag setup;
+ static ThreadExecutor executor;

Hmm, as well as the fight you started with fork() how does this scale well with having multiple Mir server instances in process? (I can see it doesn't break the test suite, but hopefully that isn't "just luck".)

Alan Griffiths (alan-griffiths) wrote :

make_socket_self_cotained

"cotained"?

~~~~

What is the intention of "system_executor()"? It seems to be used solely for all the IPC - possibly for multiple connectors on multiple servers. A more specific name would be appropriate.

review: Needs Fixing
Chris Halse Rogers (raof) wrote :

system_executor() is named as such in honour of the C++ TS. I guess it shouldn't really be named that :)

This shouldn't be a problem for multiple servers in a single process - they'll all use the same IPC thread for buffer-return messages, but each buffer-return task should be extremely quick - almost just a syscall - and there shouldn't be all that many of them - they'll generally max out at 60/s/client.

If you run *lots* of really busy servers in the same process that might start getting awkward.

4232. By Chris Halse Rogers on 2017-08-11

Give buffer_return_ipc_executor() a more descriptive name

4233. By Chris Halse Rogers on 2017-08-11

Fix typo in make_socket_self_contained()

Alan Griffiths (alan-griffiths) wrote :

Nit:

+ std::shared_ptr<boost::asio::io_service> const &io_service,
+ std::shared_ptr<boost::asio::local::stream_protocol::socket> const &socket)

Did you have CLion set to the wrong "&" placement style?

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4233
https://mir-jenkins.ubuntu.com/job/mir-ci/3552/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4864
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5077
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5066
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5066
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5066
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4901
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4901/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4901
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4901/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4901
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4901/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4901
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4901/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4901
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4901/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4901
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4901/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4901
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4901/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4901
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4901/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3552/rebuild

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

I think this is OK but in the "good old days" I would have wanted another set of eyes. (I did ask Alberto, but he's not found time - yet.)

review: Approve
Alan Griffiths (alan-griffiths) wrote :

Running miral-desktop (trunk) on this leads to orphaned titlebars and a hung server.

I need to run some more tests to isolate the problem.

review: Needs Information
Alan Griffiths (alan-griffiths) wrote :

$ sudo mir_demo_server --vt 4 --launch mir_demo_client_multistream

Wait 30 seconds(ish)...

the server hangs

review: Needs Fixing
Alan Griffiths (alan-griffiths) wrote :

> $ sudo mir_demo_server --vt 4 --launch mir_demo_client_multistream
>
> Wait 30 seconds(ish)...
>
> the server hangs

Actually, the server isn't entirely hung - but killing the child process doesn't remove it from the scene.

Alan Griffiths (alan-griffiths) wrote :

> > $ sudo mir_demo_server --vt 4 --launch mir_demo_client_multistream
> >
> > Wait 30 seconds(ish)...
> >
> > the server hangs
>
> Actually, the server isn't entirely hung - but killing the child process
> doesn't remove it from the scene.

Specifically, the server has exhausted file handles: /proc/.../fd/ has lots like this:

    lrwx------ 1 alan alan 64 Aug 15 12:03 999 -> /dev/shm/#128090392 (deleted)

Alan Griffiths (alan-griffiths) wrote :

OK, I've made some progress:

multi_stream is hitting the problem because it repeatedly creates new BufferStreams and destroying the old ones (and RenderSurfaces).

When BufferStreams are created and destroyed like this the buffer_cache in SessionMediator grows intermittently but inexorably.

Up until the point when file handles are exhausted closing the connection releases the cache and the buffers. (Once file handles are exhausted the server struggles to release the connection.)

I've not yet got my head around where the buffers created for mir_buffer_stream_get_graphics_region() are being tracked and should be released more consistently.

Chris Halse Rogers (raof) wrote :

Thanks for that!

That made it obvious that we were never actually freeing the buffers allocated on a BufferStream when it is destroyed.

I thought that (a) the client side did that, and (b) the server side *also* did that.

But it turns out that stream->associate_buffer() is actually a bunch of entirely unused bookeeping, so... :)

4234. By Chris Halse Rogers on 2017-08-16

mc::Stream: Remove vestigial client_owned_buffer_count().

Nothing uses this private method!

4235. By Chris Halse Rogers on 2017-08-16

frontend::BufferStream: Remove {associate,dissociate}_buffer.

This was only used for mc::Stream::client_owned_buffer_count, but as nothing calls
that anymore it's entirely superfluous.

4236. By Chris Halse Rogers on 2017-08-16

mf::SessionMediator: Free buffers associated with a BufferStream on release

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4236
https://mir-jenkins.ubuntu.com/job/mir-ci/3556/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4870
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5083
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5072
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5072
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5072
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4907
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4907/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4907
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4907/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4907
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4907/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4907
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4907/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4907
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4907/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4907
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4907/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4907
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4907/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4907
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4907/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3556/rebuild

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

Looking good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/server/mir/frontend/buffer_stream.h'
2--- include/server/mir/frontend/buffer_stream.h 2017-07-28 17:00:43 +0000
3+++ include/server/mir/frontend/buffer_stream.h 2017-08-16 07:06:44 +0000
4@@ -54,11 +54,6 @@
5
6 virtual MirPixelFormat pixel_format() const = 0;
7
8- //TODO: associate/disassociate_buffer are only used for timeout framedropping policy decisions.
9- // They will be removed once timeout framedropping policy moves to the client side.
10- virtual void associate_buffer(graphics::BufferID) = 0;
11- virtual void disassociate_buffer(graphics::BufferID) = 0;
12-
13 //TODO: framedropping for swapinterval-0 can probably be effectively managed from the client
14 // side once we only support the NBS system.
15 virtual void allow_framedropping(bool) = 0;
16
17=== modified file 'src/server/compositor/dropping_schedule.cpp'
18--- src/server/compositor/dropping_schedule.cpp 2017-07-28 17:00:43 +0000
19+++ src/server/compositor/dropping_schedule.cpp 2017-08-16 07:06:44 +0000
20@@ -29,18 +29,8 @@
21
22 void mc::DroppingSchedule::schedule(std::shared_ptr<mg::Buffer> const& buffer)
23 {
24- auto drop = schedule_nonblocking(buffer);
25- if (drop.valid())
26- drop.wait();
27-}
28-
29-std::future<void> mc::DroppingSchedule::schedule_nonblocking(
30- std::shared_ptr<mg::Buffer> const& buffer)
31-{
32- std::future<void> drop;
33 std::lock_guard<decltype(mutex)> lk(mutex);
34 the_only_buffer = buffer;
35- return drop;
36 }
37
38 unsigned int mc::DroppingSchedule::num_scheduled()
39
40=== modified file 'src/server/compositor/dropping_schedule.h'
41--- src/server/compositor/dropping_schedule.h 2017-07-28 17:00:43 +0000
42+++ src/server/compositor/dropping_schedule.h 2017-08-16 07:06:44 +0000
43@@ -32,8 +32,6 @@
44 public:
45 DroppingSchedule();
46 void schedule(std::shared_ptr<graphics::Buffer> const& buffer) override;
47- std::future<void> schedule_nonblocking(
48- std::shared_ptr<graphics::Buffer> const& buffer) override;
49 unsigned int num_scheduled() override;
50 std::shared_ptr<graphics::Buffer> next_buffer() override;
51
52
53=== modified file 'src/server/compositor/queueing_schedule.cpp'
54--- src/server/compositor/queueing_schedule.cpp 2017-07-28 17:00:43 +0000
55+++ src/server/compositor/queueing_schedule.cpp 2017-08-16 07:06:44 +0000
56@@ -32,13 +32,6 @@
57 queue.emplace_back(buffer);
58 }
59
60-std::future<void> mc::QueueingSchedule::schedule_nonblocking(
61- std::shared_ptr<graphics::Buffer> const& buffer)
62-{
63- schedule(buffer);
64- return {};
65-}
66-
67 unsigned int mc::QueueingSchedule::num_scheduled()
68 {
69 std::lock_guard<decltype(mutex)> lk(mutex);
70
71=== modified file 'src/server/compositor/queueing_schedule.h'
72--- src/server/compositor/queueing_schedule.h 2017-07-28 17:00:43 +0000
73+++ src/server/compositor/queueing_schedule.h 2017-08-16 07:06:44 +0000
74@@ -32,8 +32,6 @@
75 {
76 public:
77 void schedule(std::shared_ptr<graphics::Buffer> const& buffer) override;
78- std::future<void> schedule_nonblocking(
79- std::shared_ptr<graphics::Buffer> const& buffer) override;
80 unsigned int num_scheduled() override;
81 std::shared_ptr<graphics::Buffer> next_buffer() override;
82
83
84=== modified file 'src/server/compositor/schedule.h'
85--- src/server/compositor/schedule.h 2017-07-28 17:00:43 +0000
86+++ src/server/compositor/schedule.h 2017-08-16 07:06:44 +0000
87@@ -19,7 +19,6 @@
88 #define MIR_COMPOSITOR_SCHEDULE_H_
89
90 #include <memory>
91-#include <future>
92
93 namespace mir
94 {
95@@ -31,8 +30,6 @@
96 {
97 public:
98 virtual void schedule(std::shared_ptr<graphics::Buffer> const& buffer) = 0;
99- virtual std::future<void> schedule_nonblocking(
100- std::shared_ptr<graphics::Buffer> const& buffer) = 0;
101 virtual unsigned int num_scheduled() = 0;
102 virtual std::shared_ptr<graphics::Buffer> next_buffer() = 0;
103
104
105=== modified file 'src/server/compositor/stream.cpp'
106--- src/server/compositor/stream.cpp 2017-07-28 17:00:43 +0000
107+++ src/server/compositor/stream.cpp 2017-08-16 07:06:44 +0000
108@@ -48,18 +48,8 @@
109
110 mc::Stream::~Stream() = default;
111
112-unsigned int mc::Stream::client_owned_buffer_count(std::lock_guard<decltype(mutex)> const&) const
113-{
114- auto server_count = schedule->num_scheduled();
115- if (arbiter->has_buffer())
116- server_count++;
117- return associated_buffers.size() - server_count;
118-}
119-
120 void mc::Stream::submit_buffer(std::shared_ptr<mg::Buffer> const& buffer)
121 {
122- std::future<void> deferred_io;
123-
124 if (!buffer)
125 BOOST_THROW_EXCEPTION(std::invalid_argument("cannot submit null buffer"));
126
127@@ -67,17 +57,9 @@
128 std::lock_guard<decltype(mutex)> lk(mutex);
129 first_frame_posted = true;
130 pf = buffer->pixel_format();
131- deferred_io = schedule->schedule_nonblocking(buffer);
132+ schedule->schedule(buffer);
133 }
134 observers.frame_posted(1, buffer->size());
135-
136- // Ensure that mutex is not locked while we do this (synchronous!) socket
137- // IO. Holding it locked blocks the compositor thread(s) from rendering.
138- if (deferred_io.valid())
139- {
140- // TODO: Throttling of GPU hogs goes here (LP: #1211700, LP: #1665802)
141- deferred_io.wait();
142- }
143 }
144
145 void mc::Stream::with_most_recent_buffer_do(std::function<void(mg::Buffer&)> const& fn)
146@@ -184,20 +166,6 @@
147 return first_frame_posted;
148 }
149
150-void mc::Stream::associate_buffer(mg::BufferID id)
151-{
152- std::lock_guard<decltype(mutex)> lk(mutex);
153- associated_buffers.insert(id);
154-}
155-
156-void mc::Stream::disassociate_buffer(mg::BufferID id)
157-{
158- std::lock_guard<decltype(mutex)> lk(mutex);
159- auto it = associated_buffers.find(id);
160- if (it != associated_buffers.end())
161- associated_buffers.erase(it);
162-}
163-
164 void mc::Stream::set_scale(float)
165 {
166 }
167
168=== modified file 'src/server/compositor/stream.h'
169--- src/server/compositor/stream.h 2017-07-28 17:00:43 +0000
170+++ src/server/compositor/stream.h 2017-08-16 07:06:44 +0000
171@@ -56,8 +56,6 @@
172 int buffers_ready_for_compositor(void const* user_id) const override;
173 void drop_old_buffers() override;
174 bool has_submitted_buffer() const override;
175- void associate_buffer(graphics::BufferID) override;
176- void disassociate_buffer(graphics::BufferID) override;
177 void set_scale(float scale) override;
178
179 private:
180@@ -73,9 +71,6 @@
181 bool first_frame_posted;
182
183 scene::SurfaceObservers observers;
184-
185- std::set<graphics::BufferID> associated_buffers;
186- unsigned int client_owned_buffer_count(std::lock_guard<decltype(mutex)> const&) const;
187 };
188 }
189 }
190
191=== modified file 'src/server/frontend/default_ipc_factory.cpp'
192--- src/server/frontend/default_ipc_factory.cpp 2017-07-28 17:00:43 +0000
193+++ src/server/frontend/default_ipc_factory.cpp 2017-08-16 07:06:44 +0000
194@@ -29,12 +29,196 @@
195 #include "event_sink_factory.h"
196 #include "mir/graphics/graphic_buffer_allocator.h"
197 #include "mir/cookie/authority.h"
198+#include "mir/executor.h"
199+#include "mir/signal_blocker.h"
200+
201+#include <deque>
202
203 namespace mf = mir::frontend;
204 namespace mg = mir::graphics;
205 namespace mi = mir::input;
206 namespace ms = mir::scene;
207
208+namespace
209+{
210+class ThreadExecutor : public mir::Executor
211+{
212+public:
213+ ThreadExecutor() = default;
214+
215+ ThreadExecutor(ThreadExecutor const&) = delete;
216+ ThreadExecutor& operator=(ThreadExecutor const&) = delete;
217+
218+ void do_work() noexcept
219+ {
220+ std::unique_lock<std::mutex> lock{queue_mutex};
221+ for(;;)
222+ {
223+ while (!tasks.empty())
224+ {
225+ std::function<void()> task;
226+ task = std::move(tasks.front());
227+ tasks.pop_front();
228+
229+ lock.unlock();
230+ task();
231+ /*
232+ * The task functor may have captured resources with non-trivial
233+ * destructors.
234+ *
235+ * Ensure those destructors are called outside the lock.
236+ */
237+ task = nullptr;
238+ lock.lock();
239+ }
240+
241+ if (state != State::Running)
242+ {
243+ return;
244+ }
245+
246+ queue_notifier.wait(
247+ lock,
248+ [this]()
249+ {
250+ return (state != State::Running) || !tasks.empty();
251+ });
252+ }
253+ }
254+
255+ ~ThreadExecutor()
256+ {
257+ quiesce();
258+ }
259+
260+ void spawn(std::function<void()>&& work) override
261+ {
262+ {
263+ std::lock_guard<std::mutex> lock{queue_mutex};
264+ tasks.emplace_back(std::move(work));
265+
266+ if (state == State::NotYetStarted)
267+ {
268+ /*
269+ * Block all signals on the dispatch thread.
270+ *
271+ * Threads inherit their parent's signal mask, so use a SignalBlocker to block
272+ * all signals *before* spawning the thread (and then restore the signal mask
273+ * when this constructor completes).
274+ */
275+ mir::SignalBlocker blocker;
276+ state = State::Running;
277+ dispatch_thread = std::thread{std::bind(&ThreadExecutor::do_work, this)};
278+ }
279+ }
280+ queue_notifier.notify_all();
281+ }
282+
283+ void quiesce()
284+ {
285+ {
286+ std::lock_guard<std::mutex> lock{queue_mutex};
287+ state = State::Quiesced;
288+ }
289+ queue_notifier.notify_all();
290+
291+ if (dispatch_thread.joinable())
292+ dispatch_thread.join();
293+ }
294+
295+ void resume()
296+ {
297+ std::lock_guard<std::mutex> lock{queue_mutex};
298+ state = State::NotYetStarted;
299+ if (!tasks.empty())
300+ {
301+ /*
302+ * Block all signals on the dispatch thread.
303+ *
304+ * Threads inherit their parent's signal mask, so use a SignalBlocker to block
305+ * all signals *before* spawning the thread (and then restore the signal mask
306+ * when this constructor completes).
307+ */
308+ mir::SignalBlocker blocker;
309+ state = State::Running;
310+ dispatch_thread = std::thread{std::bind(&ThreadExecutor::do_work, this)};
311+ }
312+ }
313+
314+ void discard()
315+ {
316+ std::lock_guard<std::mutex> lock{queue_mutex};
317+ tasks.clear();
318+ state = State::NotYetStarted;
319+ }
320+private:
321+ std::thread dispatch_thread;
322+
323+ std::mutex queue_mutex;
324+ std::condition_variable queue_notifier;
325+ enum class State
326+ {
327+ NotYetStarted,
328+ Running,
329+ Quiesced
330+ } state{State::NotYetStarted};
331+ std::deque<std::function<void()>> tasks;
332+};
333+
334+mir::Executor& buffer_return_ipc_executor()
335+{
336+ static std::once_flag setup;
337+ static ThreadExecutor executor;
338+
339+ std::call_once(
340+ setup,
341+ []()
342+ {
343+ /*
344+ * fork() interacts with threads by screaming about being
345+ * smothered by moths and then gibbering in a corner.
346+ *
347+ * Conveniently, our test-suite makes extensive use of fork(),
348+ * and runs all the tests from a single main process, meaning
349+ * that once a single test has called executor.spawn() every
350+ * subsequent call to fork() is a call from a multithreaded
351+ * program.
352+ *
353+ * Enter the moths.
354+ *
355+ * We can get around this by quiescing the executor; temporarily
356+ * halting its execution thread and then resuming it post-fork.
357+ */
358+ pthread_atfork(
359+ []()
360+ {
361+ // Pre-fork
362+ executor.quiesce();
363+ },
364+ []()
365+ {
366+ /*
367+ * Post-fork, in the parent:
368+ * Resume execution, executing any functors queued
369+ * since quiescence.
370+ */
371+ executor.resume();
372+ },
373+ []()
374+ {
375+ /*
376+ * Post-fork, in the child:
377+ * Discard any tasks that snuck in after pre-fork but before fork();
378+ * they'll be handled in the parent.
379+ */
380+ executor.discard();
381+ });
382+ });
383+
384+ return executor;
385+}
386+}
387+
388 mf::DefaultIpcFactory::DefaultIpcFactory(
389 std::shared_ptr<Shell> const& shell,
390 std::shared_ptr<SessionMediatorObserver> const& sm_observer,
391@@ -152,5 +336,6 @@
392 cookie_authority,
393 input_changer,
394 extensions,
395- buffer_allocator);
396+ buffer_allocator,
397+ buffer_return_ipc_executor());
398 }
399
400=== modified file 'src/server/frontend/default_ipc_factory.h'
401--- src/server/frontend/default_ipc_factory.h 2017-07-28 17:00:43 +0000
402+++ src/server/frontend/default_ipc_factory.h 2017-08-16 07:06:44 +0000
403@@ -24,6 +24,9 @@
404
405 namespace mir
406 {
407+
408+class Executor;
409+
410 namespace cookie
411 {
412 class Authority;
413@@ -109,6 +112,7 @@
414 std::shared_ptr<cookie::Authority> const cookie_authority;
415 std::shared_ptr<InputConfigurationChanger> const input_changer;
416 std::vector<mir::ExtensionDescription> const extensions;
417+ std::shared_ptr<mir::Executor> const execution_queue;
418 };
419 }
420 }
421
422=== modified file 'src/server/frontend/published_socket_connector.cpp'
423--- src/server/frontend/published_socket_connector.cpp 2017-08-15 10:04:24 +0000
424+++ src/server/frontend/published_socket_connector.cpp 2017-08-16 07:06:44 +0000
425@@ -95,6 +95,30 @@
426 }
427 return socket_name;
428 }
429+
430+std::shared_ptr<boost::asio::local::stream_protocol::socket> make_socket_self_contained(
431+ std::shared_ptr<boost::asio::io_service> const &io_service,
432+ std::shared_ptr<boost::asio::local::stream_protocol::socket> const &socket)
433+{
434+ struct SelfContainedSocket {
435+ SelfContainedSocket(
436+ std::shared_ptr<boost::asio::io_service> const& io_service,
437+ std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket)
438+ : io_service{io_service},
439+ socket{socket}
440+ {
441+ }
442+
443+ std::shared_ptr<boost::asio::io_service> const io_service;
444+ std::shared_ptr<boost::asio::local::stream_protocol::socket> const socket;
445+ };
446+
447+ auto holder = std::make_shared<SelfContainedSocket>(io_service, socket);
448+
449+ return std::shared_ptr<boost::asio::local::stream_protocol::socket>(
450+ holder,
451+ holder->socket.get());
452+}
453 }
454
455 mf::PublishedSocketConnector::PublishedSocketConnector(
456@@ -104,7 +128,7 @@
457 std::shared_ptr<ConnectorReport> const& report)
458 : BasicConnector(connection_creator, report),
459 socket_file(remove_if_stale(socket_file)),
460- acceptor(io_service, socket_file)
461+ acceptor(*io_service, socket_file)
462 {
463 emergency_cleanup_registry.add(
464 [socket_file] { std::remove(socket_file.c_str()); });
465@@ -120,13 +144,26 @@
466 {
467 report->listening_on(socket_file);
468
469- auto socket = std::make_shared<boost::asio::local::stream_protocol::socket>(io_service);
470+ auto socket = std::make_shared<boost::asio::local::stream_protocol::socket>(*io_service);
471
472 acceptor.async_accept(
473 *socket,
474- [this,socket](boost::system::error_code const& ec)
475+ [
476+ this,
477+ socket,
478+ maybe_service = std::weak_ptr<boost::asio::io_service>(io_service)
479+ ](boost::system::error_code const& ec)
480 {
481- on_new_connection(socket, ec);
482+ /*
483+ * This functor lives on a queue in the io_service. If we capture a strong
484+ * reference to the io_service, we'll have a reference cycle.
485+ *
486+ * Neither io_service::reset() nor acceptor.close() appear to cause the
487+ * destruction of the functor, so just take a weak reference to the
488+ * io_service and upgrade it when something actually connects.
489+ */
490+ if (auto live_service = maybe_service.lock())
491+ on_new_connection(make_socket_self_contained(live_service, socket), ec);
492 });
493 }
494
495@@ -148,7 +185,8 @@
496 mf::BasicConnector::BasicConnector(
497 std::shared_ptr<ConnectionCreator> const& connection_creator,
498 std::shared_ptr<ConnectorReport> const& report)
499-: work(io_service),
500+: io_service(std::make_shared<boost::asio::io_service>()),
501+ work(*io_service),
502 report(report),
503 connection_creator{connection_creator}
504 {
505@@ -163,7 +201,7 @@
506 try
507 {
508 report->thread_start();
509- io_service.run();
510+ io_service->run();
511 report->thread_end();
512 return;
513 }
514@@ -179,14 +217,14 @@
515 void mf::BasicConnector::stop()
516 {
517 /* Stop processing new requests */
518- io_service.stop();
519+ io_service->stop();
520
521 /* Wait for io processing thread to finish */
522 if (io_service_thread.joinable())
523 io_service_thread.join();
524
525 /* Prepare for a potential restart */
526- io_service.reset();
527+ io_service->reset();
528 }
529
530 void mf::BasicConnector::create_session_for(
531@@ -221,11 +259,13 @@
532 }
533
534 auto const server_socket = std::make_shared<boost::asio::local::stream_protocol::socket>(
535- io_service, boost::asio::local::stream_protocol(), socket_fd[server]);
536+ *io_service,
537+ boost::asio::local::stream_protocol(),
538+ socket_fd[server]);
539
540 report->creating_socket_pair(socket_fd[server], socket_fd[client]);
541
542- create_session_for(server_socket, connect_handler);
543+ create_session_for(make_socket_self_contained(io_service, server_socket), connect_handler);
544
545 return socket_fd[client];
546 }
547
548=== modified file 'src/server/frontend/published_socket_connector.h'
549--- src/server/frontend/published_socket_connector.h 2017-07-28 17:00:43 +0000
550+++ src/server/frontend/published_socket_connector.h 2017-08-16 07:06:44 +0000
551@@ -62,7 +62,7 @@
552 std::shared_ptr<boost::asio::local::stream_protocol::socket> const& server_socket,
553 std::function<void(std::shared_ptr<Session> const& session)> const& connect_handler) const;
554
555- boost::asio::io_service mutable io_service;
556+ std::shared_ptr<boost::asio::io_service> const io_service;
557 boost::asio::io_service::work work;
558 std::shared_ptr<ConnectorReport> const report;
559
560
561=== modified file 'src/server/frontend/session_mediator.cpp'
562--- src/server/frontend/session_mediator.cpp 2017-07-28 17:00:43 +0000
563+++ src/server/frontend/session_mediator.cpp 2017-08-16 07:06:44 +0000
564@@ -60,6 +60,7 @@
565 #include "mir/cookie/authority.h"
566 #include "mir/module_properties.h"
567 #include "mir/graphics/graphic_buffer_allocator.h"
568+#include "mir/executor.h"
569
570 #include "mir/geometry/rectangles.h"
571 #include "protobuf_buffer_packer.h"
572@@ -112,7 +113,8 @@
573 std::shared_ptr<mir::cookie::Authority> const& cookie_authority,
574 std::shared_ptr<mf::InputConfigurationChanger> const& input_changer,
575 std::vector<mir::ExtensionDescription> const& extensions,
576- std::shared_ptr<mg::GraphicBufferAllocator> const& allocator) :
577+ std::shared_ptr<mg::GraphicBufferAllocator> const& allocator,
578+ mir::Executor& executor) :
579 client_pid_(0),
580 shell(shell),
581 ipc_operations(ipc_operations),
582@@ -131,7 +133,8 @@
583 cookie_authority(cookie_authority),
584 input_changer(input_changer),
585 extensions(extensions),
586- allocator{allocator}
587+ allocator{allocator},
588+ executor{executor}
589 {
590 }
591
592@@ -384,17 +387,21 @@
593 public:
594 AutoSendBuffer(
595 std::shared_ptr<mg::Buffer> const& wrapped,
596+ mir::Executor& executor,
597 std::weak_ptr<mf::BufferSink> const& sink)
598 : buffer{wrapped},
599+ executor{executor},
600 sink{sink}
601 {
602 }
603 ~AutoSendBuffer()
604 {
605- if (auto live_sink = sink.lock())
606- {
607- live_sink->update_buffer(*buffer);
608- }
609+ executor.spawn(
610+ [maybe_sink = sink, to_send = std::move(buffer)]()
611+ {
612+ if (auto const live_sink = maybe_sink.lock())
613+ live_sink->update_buffer(*to_send);
614+ });
615 }
616
617 std::shared_ptr<mir::graphics::NativeBuffer> native_buffer_handle() const override
618@@ -423,7 +430,8 @@
619 }
620
621 private:
622- std::shared_ptr<mg::Buffer> const buffer;
623+ std::shared_ptr<mg::Buffer> buffer;
624+ mir::Executor& executor;
625 std::weak_ptr<mf::BufferSink> const sink;
626 };
627
628@@ -446,7 +454,7 @@
629 auto b = buffer_cache.at(buffer_id);
630 ipc_operations->unpack_buffer(request_msg, *b);
631
632- stream->submit_buffer(std::make_shared<AutoSendBuffer>(b, event_sink));
633+ stream->submit_buffer(std::make_shared<AutoSendBuffer>(b, executor, event_sink));
634
635 done->Run();
636 }
637@@ -520,8 +528,10 @@
638
639 if (request->has_id())
640 {
641- auto stream = session->get_buffer_stream(mf::BufferStreamId(request->id().value()));
642- stream->associate_buffer(buffer->id());
643+ auto const stream_id = mf::BufferStreamId{request->id().value()};
644+ // We don't need the stream, but we *do* need to know it exists
645+ auto stream = session->get_buffer_stream(stream_id);
646+ stream_associated_buffers.insert(std::make_pair(stream_id, buffer->id()));
647 }
648
649 // TODO: Throw if insert fails (duplicate ID)?
650@@ -549,25 +559,35 @@
651 BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session"));
652
653 observer->session_release_buffers_called(session->name());
654+
655+ std::vector<mg::BufferID> to_release(request->buffers().size());
656+ std::transform(
657+ request->buffers().begin(),
658+ request->buffers().end(),
659+ to_release.begin(),
660+ [](auto buffer)
661+ {
662+ return mg::BufferID{static_cast<uint32_t>(buffer.buffer_id())};
663+ });
664+
665 if (request->has_id())
666 {
667- auto stream_id = mf::BufferStreamId{request->id().value()};
668- try
669+ auto const stream_id = mf::BufferStreamId{request->id().value()};
670+
671+ auto const associated_range = stream_associated_buffers.equal_range(stream_id);
672+ for (auto match = associated_range.first; match != associated_range.second;)
673 {
674- auto stream = session->get_buffer_stream(stream_id);
675- for (auto i = 0; i < request->buffers().size(); i++)
676+ auto const current = match;
677+ ++match;
678+ if (std::find(to_release.begin(), to_release.end(), current->second) != to_release.end())
679 {
680- mg::BufferID buffer_id{static_cast<uint32_t>(request->buffers(i).buffer_id())};
681- stream->disassociate_buffer(buffer_id);
682+
683+ stream_associated_buffers.erase(current);
684 }
685 }
686- catch(...)
687- {
688- }
689 }
690- for (auto i = 0; i < request->buffers().size(); i++)
691+ for (auto const& buffer_id : to_release)
692 {
693- mg::BufferID buffer_id{static_cast<uint32_t>(request->buffers(i).buffer_id())};
694 buffer_cache.erase(buffer_id);
695 }
696 done->Run();
697@@ -1014,6 +1034,12 @@
698
699 session->destroy_buffer_stream(id);
700
701+ auto const associated_range = stream_associated_buffers.equal_range(id) ;
702+ for (auto match = associated_range.first; match != associated_range.second; ++match)
703+ {
704+ buffer_cache.erase(match->second);
705+ }
706+
707 done->Run();
708 }
709
710
711=== modified file 'src/server/frontend/session_mediator.h'
712--- src/server/frontend/session_mediator.h 2017-07-28 17:00:43 +0000
713+++ src/server/frontend/session_mediator.h 2017-08-16 07:06:44 +0000
714@@ -40,6 +40,8 @@
715
716 namespace mir
717 {
718+class Executor;
719+
720 namespace cookie
721 {
722 class Authority;
723@@ -127,7 +129,8 @@
724 std::shared_ptr<cookie::Authority> const& cookie_authority,
725 std::shared_ptr<InputConfigurationChanger> const& input_changer,
726 std::vector<mir::ExtensionDescription> const& extensions,
727- std::shared_ptr<graphics::GraphicBufferAllocator> const& allocator);
728+ std::shared_ptr<graphics::GraphicBufferAllocator> const& allocator,
729+ mir::Executor& executor);
730
731 ~SessionMediator() noexcept;
732
733@@ -302,7 +305,9 @@
734 std::shared_ptr<InputConfigurationChanger> const input_changer;
735 std::vector<mir::ExtensionDescription> const extensions;
736 std::unordered_map<graphics::BufferID, std::shared_ptr<graphics::Buffer>> buffer_cache;
737+ std::unordered_multimap<BufferStreamId, graphics::BufferID> stream_associated_buffers;
738 std::shared_ptr<graphics::GraphicBufferAllocator> const allocator;
739+ mir::Executor& executor;
740
741 ScreencastBufferTracker screencast_buffer_tracker;
742
743
744=== modified file 'tests/include/mir/test/doubles/stub_buffer_stream.h'
745--- tests/include/mir/test/doubles/stub_buffer_stream.h 2017-07-28 17:00:43 +0000
746+++ tests/include/mir/test/doubles/stub_buffer_stream.h 2017-08-16 07:06:44 +0000
747@@ -79,8 +79,6 @@
748 void add_observer(std::shared_ptr<scene::SurfaceObserver> const&) override {}
749 void remove_observer(std::weak_ptr<scene::SurfaceObserver> const&) override {}
750 bool has_submitted_buffer() const override { return true; }
751- void associate_buffer(graphics::BufferID) override {}
752- void disassociate_buffer(graphics::BufferID) override {}
753 void set_scale(float) override {}
754
755 std::shared_ptr<graphics::Buffer> stub_compositor_buffer;
756
757=== modified file 'tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp'
758--- tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp 2017-07-28 17:00:43 +0000
759+++ tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp 2017-08-16 07:06:44 +0000
760@@ -39,12 +39,6 @@
761 {
762 throw std::runtime_error("this stub doesnt support this");
763 }
764- std::future<void> schedule_nonblocking(
765- std::shared_ptr<mg::Buffer> const&) override
766- {
767- throw std::runtime_error("this stub doesnt support this");
768- return {};
769- }
770 unsigned int num_scheduled() override
771 {
772 return sched.size() - current;
773
774=== modified file 'tests/unit-tests/compositor/test_queueing_schedule.cpp'
775--- tests/unit-tests/compositor/test_queueing_schedule.cpp 2017-07-28 17:00:43 +0000
776+++ tests/unit-tests/compositor/test_queueing_schedule.cpp 2017-08-16 07:06:44 +0000
777@@ -75,25 +75,6 @@
778 EXPECT_FALSE(schedule.num_scheduled());
779 }
780
781-TEST_F(QueueingSchedule, nonblocking_schedule_queues_buffers_up)
782-{
783- EXPECT_EQ(0u, schedule.num_scheduled());
784-
785- std::vector<std::shared_ptr<mg::Buffer>> scheduled_buffers {
786- buffers[1], buffers[3], buffers[0], buffers[2], buffers[4]
787- };
788-
789- for (auto& buffer : scheduled_buffers)
790- {
791- auto deferred_io = schedule.schedule_nonblocking(buffer);
792- EXPECT_FALSE(deferred_io.valid());
793- }
794-
795- EXPECT_EQ(scheduled_buffers.size(), schedule.num_scheduled());
796- EXPECT_THAT(drain_queue(), ContainerEq(scheduled_buffers));
797- EXPECT_EQ(0u, schedule.num_scheduled());
798-}
799-
800 TEST_F(QueueingSchedule, queuing_the_same_buffer_moves_it_to_front_of_queue)
801 {
802 for(auto i = 0u; i < num_buffers; i++)
803
804=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
805--- tests/unit-tests/frontend/test_session_mediator.cpp 2017-07-28 17:00:43 +0000
806+++ tests/unit-tests/frontend/test_session_mediator.cpp 2017-08-16 07:06:44 +0000
807@@ -272,6 +272,22 @@
808 std::vector<std::weak_ptr<mg::Buffer>> allocated_buffers;
809 };
810
811+class MockExecutor : public mir::Executor
812+{
813+public:
814+ MockExecutor()
815+ {
816+ ON_CALL(*this, spawn_thunk(_))
817+ .WillByDefault(InvokeArgument<0>());
818+ }
819+
820+ void spawn(std::function<void()>&& task) override
821+ {
822+ spawn_thunk(task);
823+ }
824+ MOCK_METHOD1(spawn_thunk, void(std::function<void()>));
825+};
826+
827 struct SessionMediator : public ::testing::Test
828 {
829 SessionMediator()
830@@ -296,7 +312,8 @@
831 mir::cookie::Authority::create(),
832 mt::fake_shared(mock_input_config_changer),
833 {},
834- allocator}
835+ allocator,
836+ executor}
837 {
838 using namespace ::testing;
839
840@@ -327,7 +344,8 @@
841 std::make_shared<mtd::NullANRDetector>(),
842 mir::cookie::Authority::create(),
843 mt::fake_shared(mock_input_config_changer), std::vector<mir::ExtensionDescription>{},
844- allocator);
845+ allocator,
846+ executor);
847 }
848
849 std::shared_ptr<mf::SessionMediator> create_session_mediator_with_screencast(
850@@ -343,7 +361,8 @@
851 std::make_shared<mtd::NullANRDetector>(),
852 mir::cookie::Authority::create(),
853 mt::fake_shared(mock_input_config_changer), std::vector<mir::ExtensionDescription>{},
854- allocator);
855+ allocator,
856+ executor);
857 }
858
859 std::shared_ptr<mf::SessionMediator> create_session_mediator_with_event_sink(
860@@ -447,7 +466,8 @@
861 mir::cookie::Authority::create(),
862 mt::fake_shared(mock_input_config_changer),
863 std::vector<mir::ExtensionDescription>{},
864- allocator);
865+ allocator,
866+ executor);
867 }
868
869 MockConnector connector;
870@@ -462,6 +482,7 @@
871 std::shared_ptr<NiceMock<StubbedSession>> const stubbed_session;
872 std::unique_ptr<google::protobuf::Closure> null_callback;
873 std::shared_ptr<RecordingBufferAllocator> const allocator;
874+ NiceMock<MockExecutor> executor;
875 mf::SessionMediator mediator;
876
877 mp::ConnectParameters connect_parameters;
878@@ -507,7 +528,8 @@
879 std::make_shared<mtd::NullANRDetector>(),
880 mir::cookie::Authority::create(),
881 mt::fake_shared(mock_input_config_changer), {},
882- allocator};
883+ allocator,
884+ executor};
885
886 EXPECT_THAT(connects_handled_count, Eq(0));
887
888@@ -997,7 +1019,8 @@
889 std::make_shared<mtd::NullANRDetector>(),
890 mir::cookie::Authority::create(),
891 mt::fake_shared(mock_input_config_changer), {},
892- allocator};
893+ allocator,
894+ executor};
895
896 ON_CALL(*shell, create_surface( _, _, _))
897 .WillByDefault(
898@@ -1155,54 +1178,6 @@
899
900 }
901
902-TEST_F(SessionMediator, disassociates_buffers_from_stream_before_destroying)
903-{
904- mp::BufferRelease release_buffer;
905- mp::BufferAllocation allocate_buffer;
906- mp::Void null;
907-
908- // Add a fake BufferStream...
909- auto stream_id = mf::BufferStreamId{42};
910- auto stream = stubbed_session->create_mock_stream(stream_id);
911-
912- // ...and allocate a buffer to it
913- allocate_buffer.mutable_id()->set_value(42);
914- auto buffer_props = allocate_buffer.add_buffer_requests();
915- buffer_props->set_buffer_usage(0);
916- buffer_props->set_pixel_format(0);
917- buffer_props->set_width(230);
918- buffer_props->set_height(230);
919-
920- mediator.connect(&connect_parameters, &connection, null_callback.get());
921- mediator.allocate_buffers(&allocate_buffer, &null, null_callback.get());
922-
923- ASSERT_THAT(allocator->allocated_buffers.size(), Eq(1));
924- auto allocated_buffer = allocator->allocated_buffers.front().lock();
925- ASSERT_THAT(allocated_buffer, NotNull());
926-
927- auto const buffer_id = allocated_buffer->id();
928-
929- // Release our share of the buffer ownership.
930- allocated_buffer.reset();
931-
932- auto buffer_item = release_buffer.add_buffers();
933- buffer_item->set_buffer_id(buffer_id.as_value());
934- release_buffer.mutable_id()->set_value(stream_id.as_value());
935-
936- EXPECT_CALL(*stream, disassociate_buffer(buffer_id))
937- .WillOnce(InvokeWithoutArgs(
938- [weak_buffer = allocator->allocated_buffers.front()]()
939- {
940- // The buffer should be live here!
941- EXPECT_THAT(weak_buffer.lock(), NotNull());
942- }));
943-
944- mediator.release_buffers(&release_buffer, &null, null_callback.get());
945-
946- // And now we expect the buffer to have been destroyed.
947- EXPECT_THAT(allocator->allocated_buffers.front().lock(), IsNull());
948-}
949-
950 TEST_F(SessionMediator, releases_buffers_of_unknown_buffer_stream_does_not_throw)
951 {
952 mp::BufferStreamId stream_to_release;
953@@ -1368,6 +1343,48 @@
954 mediator->screencast_to_buffer(&screencast_request, &null, null_callback.get());
955 }
956
957+TEST_F(SessionMediator, buffer_releases_are_sent_from_specified_executor)
958+{
959+ mp::BufferRelease release_buffer;
960+ mp::BufferAllocation allocate_buffer;
961+ mp::Void null;
962+
963+ // Add a fake BufferStream...
964+ auto stream_id = mf::BufferStreamId{42};
965+ auto stream = stubbed_session->create_mock_stream(stream_id);
966+
967+ // ...and allocate a buffer to it
968+ allocate_buffer.mutable_id()->set_value(42);
969+ auto buffer_props = allocate_buffer.add_buffer_requests();
970+ buffer_props->set_buffer_usage(0);
971+ buffer_props->set_pixel_format(0);
972+ buffer_props->set_width(230);
973+ buffer_props->set_height(230);
974+
975+ mediator.connect(&connect_parameters, &connection, null_callback.get());
976+ mediator.allocate_buffers(&allocate_buffer, &null, null_callback.get());
977+
978+ ASSERT_THAT(allocator->allocated_buffers.size(), Eq(1));
979+ auto allocated_buffer = allocator->allocated_buffers.front().lock();
980+ ASSERT_THAT(allocated_buffer, NotNull());
981+
982+ auto const buffer_id = allocated_buffer->id();
983+
984+ // Submit this buffer
985+ mp::BufferRequest submit_request;
986+ submit_request.mutable_id()->set_value(stream_id.as_value());
987+ submit_request.mutable_buffer()->set_buffer_id(buffer_id.as_value());
988+
989+ // Ensure the submitted buffer's lifetime ends immediately, and so should
990+ // get released to the client.
991+ ON_CALL(*stream, submit_buffer(_))
992+ .WillByDefault(Invoke([](auto const &){}));
993+ // And our buffer should be released by the executor.
994+ EXPECT_CALL(executor, spawn_thunk(_)).Times(1);
995+
996+ mediator.submit_buffer(&submit_request, &null, null_callback.get());
997+}
998+
999 namespace
1000 {
1001 void add_software_buffer_request(
1002@@ -1540,3 +1557,36 @@
1003 allocator->allocated_buffers,
1004 Each(Property(&std::weak_ptr<mg::Buffer>::expired, Eq(true))));
1005 }
1006+
1007+TEST_F(SessionMediator, release_buffer_stream_releases_associated_buffers)
1008+{
1009+ mp::BufferStreamId stream_id;
1010+ mp::BufferAllocation allocate_buffer;
1011+ mp::Void null;
1012+
1013+ // Add a fake BufferStream...
1014+ stream_id.set_value(42);
1015+ auto stream = stubbed_session->create_mock_stream(mf::BufferStreamId{stream_id.value()});
1016+
1017+ // ...and allocate some buffers to it
1018+ *allocate_buffer.mutable_id() = stream_id;
1019+ add_software_buffer_request(allocate_buffer, 640, 480, mir_pixel_format_argb_8888);
1020+ add_software_buffer_request(allocate_buffer, 640, 480, mir_pixel_format_argb_8888);
1021+ add_software_buffer_request(allocate_buffer, 640, 480, mir_pixel_format_argb_8888);
1022+
1023+ mediator.connect(&connect_parameters, &connection, null_callback.get());
1024+ mediator.allocate_buffers(&allocate_buffer, &null, null_callback.get());
1025+
1026+ // All the buffers should have been allocated and should be live
1027+ ASSERT_THAT(allocator->allocated_buffers.size(), Eq(3));
1028+ ASSERT_THAT(
1029+ allocator->allocated_buffers,
1030+ Each(Property(&std::weak_ptr<mg::Buffer>::expired, Eq(false))));
1031+
1032+ mediator.release_buffer_stream(&stream_id, &null, null_callback.get());
1033+
1034+ // Releasing the BufferStream should have ended the lifetime of all the buffers allocated to it.
1035+ EXPECT_THAT(
1036+ allocator->allocated_buffers,
1037+ Each(Property(&std::weak_ptr<mg::Buffer>::expired, Eq(true))));
1038+}

Subscribers

People subscribed via source and target branches