mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrei Budnik <abud...@mesosphere.com>
Subject Re: Review Request 69994: Added a test `ROOT_EmptyCheckpointFileSlaveRecovery`.
Date Wed, 20 Feb 2019 13:53:43 GMT


> On Feb. 15, 2019, 1:39 p.m., Andrei Budnik wrote:
> > src/tests/containerizer/docker_volume_isolator_tests.cpp
> > Lines 851 (patched)
> > <https://reviews.apache.org/r/69994/diff/1/?file=2125491#file2125491line851>
> >
> >     Consider `Owned<MockDockerVolumeDriverClient> mockClient`?
> 
> Qian Zhang wrote:
>     What is the benefit of using `Owned`? I see we use raw pointer for `mockClient` in
this whole file, if you think `Owned` is better, we could post a separate patch to update
it in this file.
> 
> Andrei Budnik wrote:
>     In this, test we are leaking the object of type `MockDockerVolumeDriverClient` assigned
to `mockClient` variable.
>     `Owned` automatically deletes previous objects. You can use `delete mockClient` instead
of `Owned` though.
> 
> Benjamin Bannier wrote:
>     Note that a manual `delete` would not be triggered if e.g., any `ASSERT` triggered.
That's why using any smart pointer is strictly preferable to raw pointers in tests (this is
analogue to why one needs RAII in the face of exceptions).
> 
> Qian Zhang wrote:
>     I tried to change
>     ```
>     MockDockerVolumeDriverClient* mockClient = new MockDockerVolumeDriverClient;`
>     ```
>     to
>     ```
>     Owned<MockDockerVolumeDriverClient> mockClient(new MockDockerVolumeDriverClient());
>     ```
>     
>     But the test failed with SIGSEGV at https://github.com/apache/mesos/blob/1.7.1/3rdparty/libprocess/include/process/owned.hpp#L204
, seems like a double free?

It turns out, that we move the ownership of `MockDockerVolumeDriverClient` object to `containerizer`.
Once `containerizer` object is destroyed, `MockDockerVolumeDriverClient` is freed.


- Andrei


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/69994/#review212869
-----------------------------------------------------------


On Feb. 19, 2019, 1:48 p.m., Qian Zhang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/69994/
> -----------------------------------------------------------
> 
> (Updated Feb. 19, 2019, 1:48 p.m.)
> 
> 
> Review request for mesos, Andrei Budnik and Gilbert Song.
> 
> 
> Bugs: MESOS-9507
>     https://issues.apache.org/jira/browse/MESOS-9507
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added a test `ROOT_EmptyCheckpointFileSlaveRecovery`.
> 
> 
> Diffs
> -----
> 
>   src/tests/containerizer/docker_volume_isolator_tests.cpp 1503290bf62d5718df0a530a660b519649e76789

> 
> 
> Diff: https://reviews.apache.org/r/69994/diff/3/
> 
> 
> Testing
> -------
> 
> sudo make check
> 
> This test will fail without the patch https://reviews.apache.org/r/69972
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message