You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Joseph Wu <jo...@mesosphere.io> on 2017/01/20 01:34:18 UTC

Review Request 55740: Fixed unsafe usage of process pointer in loop.hpp.

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

Review request for mesos, Benjamin Bannier, Benjamin Hindman, and Benjamin Mahler.


Repository: mesos


Description
-------

The `loop(...)` helper spawns a libprocess actor to execute some
lambda (in a loop, of course).  This actor is owned by the
libprocess GC actor, but the body of the `loop` passes a copy of that
pointer into a Future callback.  This will potentially segfault if
the actor terminates outside of the `loop`.

Instead, the `loop` should use the `PID` of the actor.


Diffs
-----

  3rdparty/libprocess/include/process/loop.hpp 8bd9715246e72474a35a0f1af94c8a5a3e87dd7a 

Diff: https://reviews.apache.org/r/55740/diff/


Testing
-------

make check


Thanks,

Joseph Wu


Re: Review Request 55740: Fixed unsafe usage of process pointer in loop.hpp.

Posted by Joseph Wu <jo...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/55740/
-----------------------------------------------------------

(Updated Jan. 20, 2017, 1:37 p.m.)


Review request for mesos, Benjamin Bannier, Benjamin Hindman, and Benjamin Mahler.


Repository: mesos


Description (updated)
-------

The `loop(...)` helper spawns a libprocess actor to execute some
lambda (in a loop, of course).  This actor is owned by the
libprocess GC actor, but the body of the `loop` passes a copy of that
pointer into a Future callback.  This will potentially segfault if
the actor terminates outside of the `loop`.

Instead, the `loop` should use the `PID` of the actor.  This change
will make the `loop` code safer, just in case a future commit terminates
the loop actor (such as the use of `process::finalize`).


Diffs
-----

  3rdparty/libprocess/include/process/loop.hpp 8bd9715246e72474a35a0f1af94c8a5a3e87dd7a 

Diff: https://reviews.apache.org/r/55740/diff/


Testing
-------

make check


Thanks,

Joseph Wu


Re: Review Request 55740: Fixed unsafe usage of process pointer in loop.hpp.

Posted by Mesos Reviewbot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/55740/#review162387
-----------------------------------------------------------



Patch looks great!

Reviews applied: [55701, 55740]

Passed command: export OS='ubuntu:14.04' BUILDTOOL='autotools' COMPILER='gcc' CONFIGURATION='--verbose' ENVIRONMENT='GLOG_v=1 MESOS_VERBOSE=1'; ./support/docker-build.sh

- Mesos Reviewbot


On Jan. 20, 2017, 1:34 a.m., Joseph Wu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/55740/
> -----------------------------------------------------------
> 
> (Updated Jan. 20, 2017, 1:34 a.m.)
> 
> 
> Review request for mesos, Benjamin Bannier, Benjamin Hindman, and Benjamin Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> The `loop(...)` helper spawns a libprocess actor to execute some
> lambda (in a loop, of course).  This actor is owned by the
> libprocess GC actor, but the body of the `loop` passes a copy of that
> pointer into a Future callback.  This will potentially segfault if
> the actor terminates outside of the `loop`.
> 
> Instead, the `loop` should use the `PID` of the actor.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/loop.hpp 8bd9715246e72474a35a0f1af94c8a5a3e87dd7a 
> 
> Diff: https://reviews.apache.org/r/55740/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Joseph Wu
> 
>


Re: Review Request 55740: Fixed unsafe usage of process pointer in loop.hpp.

Posted by Joseph Wu <jo...@mesosphere.io>.

> On Jan. 19, 2017, 7:52 p.m., Benjamin Mahler wrote:
> > I would suggest clarifying in the commit that there isn't an issue here currently (right?), but the code is brittle and we want to make generally safer.

I think this isn't a problem because we don't have any intersection between the code using `loop` and the code using `process::finalize`.  I'll clarify to mention future-proofing.


- Joseph


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


On Jan. 19, 2017, 5:34 p.m., Joseph Wu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/55740/
> -----------------------------------------------------------
> 
> (Updated Jan. 19, 2017, 5:34 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier, Benjamin Hindman, and Benjamin Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> The `loop(...)` helper spawns a libprocess actor to execute some
> lambda (in a loop, of course).  This actor is owned by the
> libprocess GC actor, but the body of the `loop` passes a copy of that
> pointer into a Future callback.  This will potentially segfault if
> the actor terminates outside of the `loop`.
> 
> Instead, the `loop` should use the `PID` of the actor.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/loop.hpp 8bd9715246e72474a35a0f1af94c8a5a3e87dd7a 
> 
> Diff: https://reviews.apache.org/r/55740/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Joseph Wu
> 
>


Re: Review Request 55740: Fixed unsafe usage of process pointer in loop.hpp.

Posted by Benjamin Mahler <bm...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/55740/#review162384
-----------------------------------------------------------


Ship it!




I would suggest clarifying in the commit that there isn't an issue here currently (right?), but the code is brittle and we want to make generally safer.

- Benjamin Mahler


On Jan. 20, 2017, 1:34 a.m., Joseph Wu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/55740/
> -----------------------------------------------------------
> 
> (Updated Jan. 20, 2017, 1:34 a.m.)
> 
> 
> Review request for mesos, Benjamin Bannier, Benjamin Hindman, and Benjamin Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> The `loop(...)` helper spawns a libprocess actor to execute some
> lambda (in a loop, of course).  This actor is owned by the
> libprocess GC actor, but the body of the `loop` passes a copy of that
> pointer into a Future callback.  This will potentially segfault if
> the actor terminates outside of the `loop`.
> 
> Instead, the `loop` should use the `PID` of the actor.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/loop.hpp 8bd9715246e72474a35a0f1af94c8a5a3e87dd7a 
> 
> Diff: https://reviews.apache.org/r/55740/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Joseph Wu
> 
>


Re: Review Request 55740: Fixed unsafe usage of process pointer in loop.hpp.

Posted by Benjamin Bannier <be...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/55740/#review162407
-----------------------------------------------------------


Ship it!




Agree with Ben here. I do not see how there is an actual danger from this code today. This change future-proofs this code by raising the level of abstraction.

- Benjamin Bannier


On Jan. 20, 2017, 2:34 a.m., Joseph Wu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/55740/
> -----------------------------------------------------------
> 
> (Updated Jan. 20, 2017, 2:34 a.m.)
> 
> 
> Review request for mesos, Benjamin Bannier, Benjamin Hindman, and Benjamin Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> The `loop(...)` helper spawns a libprocess actor to execute some
> lambda (in a loop, of course).  This actor is owned by the
> libprocess GC actor, but the body of the `loop` passes a copy of that
> pointer into a Future callback.  This will potentially segfault if
> the actor terminates outside of the `loop`.
> 
> Instead, the `loop` should use the `PID` of the actor.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/loop.hpp 8bd9715246e72474a35a0f1af94c8a5a3e87dd7a 
> 
> Diff: https://reviews.apache.org/r/55740/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Joseph Wu
> 
>