Re: Review Request 65683: Updated discard handling of the Docker 'inspect' call.

2018-02-23 Thread Greg Mann

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




src/docker/docker.cpp
Lines 1287 (patched)


Derp. This will clearly not work because the `s` which we capture into the 
`onDiscard` callback is a different copy than the `s` which we reassign in 
`_inspect()`.

It probably makes sense to use a `shared_ptr` here, and do an 
`atomic_exchange` to reassign. This will maintain thread safety, and keep the 
object alive until the `onDiscard` callback has executed.


- Greg Mann


On Feb. 23, 2018, 11:07 p.m., Greg Mann wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65683/
> ---
> 
> (Updated Feb. 23, 2018, 11:07 p.m.)
> 
> 
> Review request for mesos, Andrei Budnik, Gilbert Song, Michael Park, and 
> Vinod Kone.
> 
> 
> Bugs: MESOS-8575
> https://issues.apache.org/jira/browse/MESOS-8575
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Updated discard handling of the Docker 'inspect' call.
> 
> 
> Diffs
> -
> 
>   src/docker/docker.hpp d9e71f8841a868082170d28fc4f3d495e2eb1e61 
>   src/docker/docker.cpp 3df370e988fce12d323ff6b441da15dab27bdd28 
> 
> 
> Diff: https://reviews.apache.org/r/65683/diff/6/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Greg Mann
> 
>



Re: Review Request 65683: Updated discard handling of the Docker 'inspect' call.

2018-02-23 Thread Greg Mann


> On Feb. 23, 2018, 5:38 p.m., Gilbert Song wrote:
> > src/docker/docker.cpp
> > Lines 1199 (patched)
> > 
> >
> > Should we use a lambda instead of `lambda::bind`? (I know we want 
> > consistency in this file since we used `lambda::bind` in two other places)
> > 
> > e.g.,
> > ```
> > .onDiscard([=]() {
> >   return commandDiscarded();
> > }
> > ```
> > 
> > We used `lambda::bind` before we have the lambda support in libprocess.

I think I'll just leave it to be consistent with the other callsites if that's 
OK. We could update them all together.


- Greg


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


On Feb. 23, 2018, 11:07 p.m., Greg Mann wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65683/
> ---
> 
> (Updated Feb. 23, 2018, 11:07 p.m.)
> 
> 
> Review request for mesos, Andrei Budnik, Gilbert Song, Michael Park, and 
> Vinod Kone.
> 
> 
> Bugs: MESOS-8575
> https://issues.apache.org/jira/browse/MESOS-8575
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Updated discard handling of the Docker 'inspect' call.
> 
> 
> Diffs
> -
> 
>   src/docker/docker.hpp d9e71f8841a868082170d28fc4f3d495e2eb1e61 
>   src/docker/docker.cpp 3df370e988fce12d323ff6b441da15dab27bdd28 
> 
> 
> Diff: https://reviews.apache.org/r/65683/diff/6/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Greg Mann
> 
>



Re: Review Request 65683: Updated discard handling of the Docker 'inspect' call.

2018-02-23 Thread Greg Mann


> On Feb. 23, 2018, 5:38 p.m., Gilbert Song wrote:
> > src/docker/docker.cpp
> > Lines 151 (patched)
> > 
> >
> > Should we do `killtree()` even if the status is not pending (e.g., 
> > ready or failure)?
> > 
> > If the semantic (caller invokes `.discard()` -> no longer care about 
> > the subprocess) is something we want to define for the library, should we 
> > always killtree regardless whatever status?

I think it's incorrect for us to kill the process if `s.status()` is no longer 
pending. In that case, the process has actually terminated, so the PID could be 
some completely unrelated process which was spawned recently.


- Greg


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


On Feb. 23, 2018, 11:07 p.m., Greg Mann wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65683/
> ---
> 
> (Updated Feb. 23, 2018, 11:07 p.m.)
> 
> 
> Review request for mesos, Andrei Budnik, Gilbert Song, Michael Park, and 
> Vinod Kone.
> 
> 
> Bugs: MESOS-8575
> https://issues.apache.org/jira/browse/MESOS-8575
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Updated discard handling of the Docker 'inspect' call.
> 
> 
> Diffs
> -
> 
>   src/docker/docker.hpp d9e71f8841a868082170d28fc4f3d495e2eb1e61 
>   src/docker/docker.cpp 3df370e988fce12d323ff6b441da15dab27bdd28 
> 
> 
> Diff: https://reviews.apache.org/r/65683/diff/6/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Greg Mann
> 
>



Re: Review Request 65683: Updated discard handling of the Docker 'inspect' call.

2018-02-23 Thread Greg Mann


> On Feb. 23, 2018, 9:14 a.m., Greg Mann wrote:
> > src/docker/docker.cpp
> > Lines 1287-1293 (patched)
> > 
> >
> > Whoops, this is not threadsafe :facepalm:
> > 
> > For example, we could call `output->discard()` from two different 
> > threads simultaneously (see `__inspect`).
> > 
> > I need to figure out a better way to do this...
> 
> Andrei Budnik wrote:
> One possible solution might be using `defer(self(), ...)` for callbacks.
> 
> Gilbert Song wrote:
> yea, you may need `defer`.
> 
> Greg Mann wrote:
> Unfortunately, the docker library is not a libprocess process :'( So we 
> have nothing to defer to.

I got rid of the `Owned> output`, and used a `Shared` for the 
subprocess. I think this works.


- Greg


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


On Feb. 23, 2018, 11:07 p.m., Greg Mann wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65683/
> ---
> 
> (Updated Feb. 23, 2018, 11:07 p.m.)
> 
> 
> Review request for mesos, Andrei Budnik, Gilbert Song, Michael Park, and 
> Vinod Kone.
> 
> 
> Bugs: MESOS-8575
> https://issues.apache.org/jira/browse/MESOS-8575
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Updated discard handling of the Docker 'inspect' call.
> 
> 
> Diffs
> -
> 
>   src/docker/docker.hpp d9e71f8841a868082170d28fc4f3d495e2eb1e61 
>   src/docker/docker.cpp 3df370e988fce12d323ff6b441da15dab27bdd28 
> 
> 
> Diff: https://reviews.apache.org/r/65683/diff/6/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Greg Mann
> 
>



Re: Review Request 65683: Updated discard handling of the Docker 'inspect' call.

2018-02-23 Thread Greg Mann

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

(Updated Feb. 23, 2018, 11:07 p.m.)


Review request for mesos, Andrei Budnik, Gilbert Song, Michael Park, and Vinod 
Kone.


Summary (updated)
-

Updated discard handling of the Docker 'inspect' call.


Bugs: MESOS-8575
https://issues.apache.org/jira/browse/MESOS-8575


Repository: mesos


Description (updated)
---

Updated discard handling of the Docker 'inspect' call.


Diffs (updated)
-

  src/docker/docker.hpp d9e71f8841a868082170d28fc4f3d495e2eb1e61 
  src/docker/docker.cpp 3df370e988fce12d323ff6b441da15dab27bdd28 


Diff: https://reviews.apache.org/r/65683/diff/6/

Changes: https://reviews.apache.org/r/65683/diff/5-6/


Testing
---


Thanks,

Greg Mann