Mir

Merge lp:~alan-griffiths/mir/fix-1386646 into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alberto Aguirre
Approved revision: no longer in the source branch.
Merged at revision: 2010
Proposed branch: lp:~alan-griffiths/mir/fix-1386646
Merge into: lp:mir
Diff against target: 45 lines (+12/-5)
2 files modified
src/client/mir_connection.cpp (+2/-0)
tests/integration-tests/test_protobuf.cpp (+10/-5)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1386646
Reviewer Review Type Date Requested Status
Kevin DuBois (community) Approve
Alberto Aguirre (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+239848@code.launchpad.net

Commit message

client: avoid lifecycle notifications racing with connection release.

Description of the change

client: avoid lifecycle notifications racing with connection release.

Not only our code, but also user code, is likely to assume lifecycle notifications can't happen once the connection has been released.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> [ RUN ] DemoPrivateProtobuf.client_calls_server
> ==8885==
> ==8885== HEAP SUMMARY:
> ==8885== in use at exit: 211,741 bytes in 3,421 blocks
> ==8885== total heap usage: 9,029 allocs, 5,608 frees, 598,608 bytes allocated
> ==8885==
> ==8885== LEAK SUMMARY:
> ==8885== definitely lost: 0 bytes in 0 blocks
> ==8885== indirectly lost: 0 bytes in 0 blocks
> ==8885== possibly lost: 52,192 bytes in 940 blocks
> ==8885== still reachable: 159,549 bytes in 2,481 blocks
> ==8885== suppressed: 0 bytes in 0 blocks
> ==8885== Reachable blocks (those to which a pointer was found) are not shown.
> ==8885== To see them, rerun with: --leak-check=full --show-leak-kinds=all
> ==8885==
> ==8885== For counts of detected and suppressed errors, rerun with: -v
> ==8885== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
>
> test 11

:(

It appears the race is unrelated to this test failure.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

A different error on a different architecture:

    E: Couldn't download packages: libisl10 libpthread-stubs0-dev sysv-rc

I guess an infrastructure glitch - triggering rebuild. (Which incidentally re-tries the AMD64 arch)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

LGTM.

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

makes sense to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/client/mir_connection.cpp'
2--- src/client/mir_connection.cpp 2014-10-28 00:29:39 +0000
3+++ src/client/mir_connection.cpp 2014-10-28 15:08:15 +0000
4@@ -300,6 +300,8 @@
5 delete handle;
6 }
7
8+ // Ensure no racy lifecycle notifications can happen after disconnect completes
9+ lifecycle_control->set_lifecycle_event_handler([](MirLifecycleState){});
10 disconnect_wait_handle.result_received();
11 }
12
13
14=== modified file 'tests/integration-tests/test_protobuf.cpp'
15--- tests/integration-tests/test_protobuf.cpp 2014-10-27 17:30:19 +0000
16+++ tests/integration-tests/test_protobuf.cpp 2014-10-28 15:08:15 +0000
17@@ -205,6 +205,16 @@
18 result.set_error(nothing_returned);
19 std::atomic<bool> called_back{false};
20
21+ // After the call there's a race between the client releasing the connection
22+ // and the server dropping the connection.
23+ // If the latter wins we'll invoke the client's lifecycle_event_callback.
24+ // As the default callback kills the process with SIGHUP, we need to
25+ // replace it to ensure the test can continue.
26+ mir_connection_set_lifecycle_event_callback(
27+ connection,
28+ [](MirConnection*, MirLifecycleState, void*){},
29+ nullptr);
30+
31 // Note:
32 // As the default server won't recognise this call it drops the connection
33 // resulting in a callback when the connection drops (but result being unchanged)
34@@ -214,11 +224,6 @@
35 &result,
36 NewCallback(&callback, &called_back));
37
38- // FIXME - This test is somehow racy. If I add:
39- // EXPECT_TRUE(false) << connection;
40- // then I can get mir_connection_release to generate an exception during
41- // disconnect() internally, sometimes. Although that exception is caught
42- // internally by the client library so we don't see it here.
43 mir_connection_release(connection);
44
45 EXPECT_TRUE(called_back);

Subscribers

People subscribed via source and target branches