You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Ian Downes <ia...@gmail.com> on 2014/05/01 21:17:15 UTC

Review Request 20970: Add os::exists(pid_t) to (cheaply) test if a pid is running.

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

Review request for mesos, Ben Mahler and Vinod Kone.


Repository: mesos-git


Description
-------

Uses kill(0, pid) to check pid validity. This is much cheaper than using os::process(pid) which constructs a full Process object. Works regardless of permission to signal the pid.


Diffs
-----

  3rdparty/libprocess/3rdparty/stout/include/stout/os/exists.hpp d9860d754e04f4ab5cc8f0a095b758ec62626b90 
  3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp 94eb256d24bc001660d63bd91b608988205a3d09 

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


Testing
-------

# Added a test
make check 


Thanks,

Ian Downes


Re: Review Request 20970: Add os::exists(pid_t) to (cheaply) test if a pid is running.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20970/#review42076
-----------------------------------------------------------

Ship it!


Please go ahead and commit this, but first, please wrap comments at 70 characters. (I've seen a number of patches lately not doing this but this is actually part of our (unfortunately) implicit style).


3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
<https://reviews.apache.org/r/20970/#comment75822>

    Consider having this loop fail after a certain amount of time has passed, akin to what is done in OsTest.killtree


- Ben Mahler


On May 2, 2014, 8:48 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20970/
> -----------------------------------------------------------
> 
> (Updated May 2, 2014, 8:48 p.m.)
> 
> 
> Review request for mesos, Ben Mahler and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Uses kill(0, pid) to check pid validity. This is much cheaper than using os::process(pid) which constructs a full Process object. Works regardless of permission to signal the pid.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os/exists.hpp d9860d754e04f4ab5cc8f0a095b758ec62626b90 
>   3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp 94eb256d24bc001660d63bd91b608988205a3d09 
> 
> Diff: https://reviews.apache.org/r/20970/diff/
> 
> 
> Testing
> -------
> 
> # Added a test
> make check 
> 
> 
> Thanks,
> 
> Ian Downes
> 
>


Re: Review Request 20970: Add os::exists(pid_t) to (cheaply) test if a pid is running.

Posted by Ian Downes <ia...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20970/
-----------------------------------------------------------

(Updated May 2, 2014, 1:48 p.m.)


Review request for mesos, Ben Mahler and Vinod Kone.


Changes
-------

Added additional comments. Improved test to verify zombie process exists.


Repository: mesos-git


Description
-------

Uses kill(0, pid) to check pid validity. This is much cheaper than using os::process(pid) which constructs a full Process object. Works regardless of permission to signal the pid.


Diffs (updated)
-----

  3rdparty/libprocess/3rdparty/stout/include/stout/os/exists.hpp d9860d754e04f4ab5cc8f0a095b758ec62626b90 
  3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp 94eb256d24bc001660d63bd91b608988205a3d09 

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


Testing
-------

# Added a test
make check 


Thanks,

Ian Downes


Re: Review Request 20970: Add os::exists(pid_t) to (cheaply) test if a pid is running.

Posted by Ian Downes <ia...@gmail.com>.

> On May 1, 2014, 5:53 p.m., Vinod Kone wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/os/exists.hpp, line 38
> > <https://reviews.apache.org/r/20970/diff/1/?file=572847#file572847line38>
> >
> >     is it possible to get a EPERM with sig 0?

Yes, if you don't have permission to send signals to the process (but the process does exist) then return is -1 and errno == EPERM

[EPERM] The sending process is not the super-user and its effective user id does not match the effective user-id of the receiving process.


- Ian


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


On May 1, 2014, 12:17 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20970/
> -----------------------------------------------------------
> 
> (Updated May 1, 2014, 12:17 p.m.)
> 
> 
> Review request for mesos, Ben Mahler and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Uses kill(0, pid) to check pid validity. This is much cheaper than using os::process(pid) which constructs a full Process object. Works regardless of permission to signal the pid.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os/exists.hpp d9860d754e04f4ab5cc8f0a095b758ec62626b90 
>   3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp 94eb256d24bc001660d63bd91b608988205a3d09 
> 
> Diff: https://reviews.apache.org/r/20970/diff/
> 
> 
> Testing
> -------
> 
> # Added a test
> make check 
> 
> 
> Thanks,
> 
> Ian Downes
> 
>


Re: Review Request 20970: Add os::exists(pid_t) to (cheaply) test if a pid is running.

Posted by Vinod Kone <vi...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20970/#review41991
-----------------------------------------------------------

Ship it!



3rdparty/libprocess/3rdparty/stout/include/stout/os/exists.hpp
<https://reviews.apache.org/r/20970/#comment75717>

    is it possible to get a EPERM with sig 0?


- Vinod Kone


On May 1, 2014, 7:17 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20970/
> -----------------------------------------------------------
> 
> (Updated May 1, 2014, 7:17 p.m.)
> 
> 
> Review request for mesos, Ben Mahler and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Uses kill(0, pid) to check pid validity. This is much cheaper than using os::process(pid) which constructs a full Process object. Works regardless of permission to signal the pid.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os/exists.hpp d9860d754e04f4ab5cc8f0a095b758ec62626b90 
>   3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp 94eb256d24bc001660d63bd91b608988205a3d09 
> 
> Diff: https://reviews.apache.org/r/20970/diff/
> 
> 
> Testing
> -------
> 
> # Added a test
> make check 
> 
> 
> Thanks,
> 
> Ian Downes
> 
>


Re: Review Request 20970: Add os::exists(pid_t) to (cheaply) test if a pid is running.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/20970/#review41997
-----------------------------------------------------------

Ship it!


Please document why EPERM is needed as vinod mentioned, are there permission issues? Your description suggests otherwise! :)


3rdparty/libprocess/3rdparty/stout/include/stout/os/exists.hpp
<https://reviews.apache.org/r/20970/#comment75726>

    newline please :)



3rdparty/libprocess/3rdparty/stout/include/stout/os/exists.hpp
<https://reviews.apache.org/r/20970/#comment75727>

    What are the semantics around zombie processes? Can you document that?



3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
<https://reviews.apache.org/r/20970/#comment75729>

    newline please :)



3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
<https://reviews.apache.org/r/20970/#comment75731>

    After this assertion, can you validate the fact that os::exists still returns true here? (After the kill, before the reap).
    
    If it's not returning true for zombies, then we have a problem in r/20971, so would be great to test this!



3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
<https://reviews.apache.org/r/20970/#comment75730>

    newline here please :)


- Ben Mahler


On May 1, 2014, 7:17 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/20970/
> -----------------------------------------------------------
> 
> (Updated May 1, 2014, 7:17 p.m.)
> 
> 
> Review request for mesos, Ben Mahler and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Uses kill(0, pid) to check pid validity. This is much cheaper than using os::process(pid) which constructs a full Process object. Works regardless of permission to signal the pid.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os/exists.hpp d9860d754e04f4ab5cc8f0a095b758ec62626b90 
>   3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp 94eb256d24bc001660d63bd91b608988205a3d09 
> 
> Diff: https://reviews.apache.org/r/20970/diff/
> 
> 
> Testing
> -------
> 
> # Added a test
> make check 
> 
> 
> Thanks,
> 
> Ian Downes
> 
>