You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Andrei Budnik <ab...@mesosphere.com> on 2017/08/21 20:54:13 UTC
Review Request 61797: Added async-signal safe implementation of
`write` function in stout.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61797/
-----------------------------------------------------------
Review request for mesos, Alexander Rukletsov, Benjamin Bannier, Benjamin Mahler, and James Peach.
Bugs: MESOS-7791
https://issues.apache.org/jira/browse/MESOS-7791
Repository: mesos
Description
-------
Async-signal safe `write` function, which can take variable number of
arguments, should be used to improve signal safety.
Diffs
-----
3rdparty/stout/include/stout/os/write.hpp beb5bd83b52565a75e34d32b5bb17951bc799578
Diff: https://reviews.apache.org/r/61797/diff/1/
Testing
-------
sudo make check (mac os x, fedora 25)
internal CI
Thanks,
Andrei Budnik
Re: Review Request 61797: Added async-signal safe implementation of
`write` function in stout.
Posted by Alexander Rojas <al...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61797/#review184128
-----------------------------------------------------------
Ship it!
Ship It!
- Alexander Rojas
On Aug. 21, 2017, 10:54 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61797/
> -----------------------------------------------------------
>
> (Updated Aug. 21, 2017, 10:54 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Benjamin Bannier, Benjamin Mahler, and James Peach.
>
>
> Bugs: MESOS-7791
> https://issues.apache.org/jira/browse/MESOS-7791
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Async-signal safe `write` function, which can take variable number of
> arguments, should be used to improve signal safety. Async-signal safe
> `write` can't return `Try<T>`, because it might cause a memory
> allocation, so we've introduced a set of async-signal safe `write`
> functions which are defined in `signal_safe` namespace. The new `write`
> mimics POSIX `write` for returning status and error.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/abort.hpp d3291dce8ec3db6141124e9cd231d34409998a18
> 3rdparty/stout/include/stout/os/write.hpp beb5bd83b52565a75e34d32b5bb17951bc799578
>
>
> Diff: https://reviews.apache.org/r/61797/diff/7/
>
>
> Testing
> -------
>
> sudo make check (mac os x, fedora 25)
> internal CI
>
>
> Thanks,
>
> Andrei Budnik
>
>
Re: Review Request 61797: Added async-signal safe implementation of
`write` function in stout.
Posted by Andrei Budnik <ab...@mesosphere.com>.
> On Aug. 24, 2017, 6:28 p.m., James Peach wrote:
> > 3rdparty/stout/include/stout/os/write.hpp
> > Lines 66 (patched)
> > <https://reviews.apache.org/r/61797/diff/4/?file=1802875#file1802875line67>
> >
> > Write returns `ssize_t` here and in all the other variants in this file.
> >
> > OK I ended up later in the patch series and realized that this is returning `errno`. If you really want to do that, it needs to be much more explicit, since everyone reading this is going to assume that `write` returns a count.
> >
> > Other than introducing a new type, one option might be to return `bool` from these functions and let the caller examine `errno`.
>
> Andrei Budnik wrote:
> I agree, returning `ssize_t` seems more reasonable to me.
Fixed: `write` returns `ssize_t`.
- Andrei
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61797/#review183754
-----------------------------------------------------------
On Aug. 21, 2017, 8:54 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61797/
> -----------------------------------------------------------
>
> (Updated Aug. 21, 2017, 8:54 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Benjamin Bannier, Benjamin Mahler, and James Peach.
>
>
> Bugs: MESOS-7791
> https://issues.apache.org/jira/browse/MESOS-7791
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Async-signal safe `write` function, which can take variable number of
> arguments, should be used to improve signal safety.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/abort.hpp d3291dce8ec3db6141124e9cd231d34409998a18
> 3rdparty/stout/include/stout/os/write.hpp beb5bd83b52565a75e34d32b5bb17951bc799578
>
>
> Diff: https://reviews.apache.org/r/61797/diff/5/
>
>
> Testing
> -------
>
> sudo make check (mac os x, fedora 25)
> internal CI
>
>
> Thanks,
>
> Andrei Budnik
>
>
Re: Review Request 61797: Added async-signal safe implementation of
`write` function in stout.
Posted by Andrei Budnik <ab...@mesosphere.com>.
> On Aug. 24, 2017, 6:28 p.m., James Peach wrote:
> > 3rdparty/stout/include/stout/os/write.hpp
> > Lines 66 (patched)
> > <https://reviews.apache.org/r/61797/diff/4/?file=1802875#file1802875line67>
> >
> > Write returns `ssize_t` here and in all the other variants in this file.
> >
> > OK I ended up later in the patch series and realized that this is returning `errno`. If you really want to do that, it needs to be much more explicit, since everyone reading this is going to assume that `write` returns a count.
> >
> > Other than introducing a new type, one option might be to return `bool` from these functions and let the caller examine `errno`.
I agree, returning `ssize_t` seems more reasonable to me.
> On Aug. 24, 2017, 6:28 p.m., James Peach wrote:
> > 3rdparty/stout/include/stout/os/write.hpp
> > Lines 87 (patched)
> > <https://reviews.apache.org/r/61797/diff/4/?file=1802875#file1802875line88>
> >
> > The recursion could be a problem in signal handlers with limited stack, but I couldn't see a better way to do this :)
I'm not sure if a compiler can eliminate tail recursion in this case.
I expect small number of arguments (say, less than 10), so even with quadratic memory complexity, stack should typically have size of only a few hundred bytes.
- Andrei
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61797/#review183754
-----------------------------------------------------------
On Aug. 21, 2017, 8:54 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61797/
> -----------------------------------------------------------
>
> (Updated Aug. 21, 2017, 8:54 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Benjamin Bannier, Benjamin Mahler, and James Peach.
>
>
> Bugs: MESOS-7791
> https://issues.apache.org/jira/browse/MESOS-7791
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Async-signal safe `write` function, which can take variable number of
> arguments, should be used to improve signal safety.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/abort.hpp d3291dce8ec3db6141124e9cd231d34409998a18
> 3rdparty/stout/include/stout/os/write.hpp beb5bd83b52565a75e34d32b5bb17951bc799578
>
>
> Diff: https://reviews.apache.org/r/61797/diff/4/
>
>
> Testing
> -------
>
> sudo make check (mac os x, fedora 25)
> internal CI
>
>
> Thanks,
>
> Andrei Budnik
>
>
Re: Review Request 61797: Added async-signal safe implementation of
`write` function in stout.
Posted by James Peach <jp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61797/#review183754
-----------------------------------------------------------
3rdparty/stout/include/stout/os/write.hpp
Lines 66 (patched)
<https://reviews.apache.org/r/61797/#comment259808>
Write returns `ssize_t` here and in all the other variants in this file.
OK I ended up later in the patch series and realized that this is returning `errno`. If you really want to do that, it needs to be much more explicit, since everyone reading this is going to assume that `write` returns a count.
Other than introducing a new type, one option might be to return `bool` from these functions and let the caller examine `errno`.
3rdparty/stout/include/stout/os/write.hpp
Lines 87 (patched)
<https://reviews.apache.org/r/61797/#comment259817>
The recursion could be a problem in signal handlers with limited stack, but I couldn't see a better way to do this :)
- James Peach
On Aug. 21, 2017, 8:54 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61797/
> -----------------------------------------------------------
>
> (Updated Aug. 21, 2017, 8:54 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Benjamin Bannier, Benjamin Mahler, and James Peach.
>
>
> Bugs: MESOS-7791
> https://issues.apache.org/jira/browse/MESOS-7791
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Async-signal safe `write` function, which can take variable number of
> arguments, should be used to improve signal safety.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/abort.hpp d3291dce8ec3db6141124e9cd231d34409998a18
> 3rdparty/stout/include/stout/os/write.hpp beb5bd83b52565a75e34d32b5bb17951bc799578
>
>
> Diff: https://reviews.apache.org/r/61797/diff/4/
>
>
> Testing
> -------
>
> sudo make check (mac os x, fedora 25)
> internal CI
>
>
> Thanks,
>
> Andrei Budnik
>
>
Re: Review Request 61797: Added async-signal safe implementation of
`write` function in stout.
Posted by James Peach <jp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61797/#review184056
-----------------------------------------------------------
Ship it!
Ship It!
- James Peach
On Aug. 21, 2017, 8:54 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61797/
> -----------------------------------------------------------
>
> (Updated Aug. 21, 2017, 8:54 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Benjamin Bannier, Benjamin Mahler, and James Peach.
>
>
> Bugs: MESOS-7791
> https://issues.apache.org/jira/browse/MESOS-7791
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Async-signal safe `write` function, which can take variable number of
> arguments, should be used to improve signal safety. Async-signal safe
> `write` can't return `Try<T>`, because it might cause a memory
> allocation, so we've introduced a set of async-signal safe `write`
> functions which are defined in `signal_safe` namespace. The new `write`
> mimics POSIX `write` for returning status and error.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/abort.hpp d3291dce8ec3db6141124e9cd231d34409998a18
> 3rdparty/stout/include/stout/os/write.hpp beb5bd83b52565a75e34d32b5bb17951bc799578
>
>
> Diff: https://reviews.apache.org/r/61797/diff/6/
>
>
> Testing
> -------
>
> sudo make check (mac os x, fedora 25)
> internal CI
>
>
> Thanks,
>
> Andrei Budnik
>
>
Re: Review Request 61797: Added async-signal safe implementation of
`write` function in stout.
Posted by Andrei Budnik <ab...@mesosphere.com>.
> On Aug. 22, 2017, 10:46 a.m., Alexander Rukletsov wrote:
> > 3rdparty/stout/include/stout/os/write.hpp
> > Lines 67 (patched)
> > <https://reviews.apache.org/r/61797/diff/1/?file=1801032#file1801032line68>
> >
> > `std::strlen`?
I'm not sure if `std::strlen` is async-signal safe.
> On Aug. 22, 2017, 10:46 a.m., Alexander Rukletsov wrote:
> > 3rdparty/stout/include/stout/os/write.hpp
> > Line 60 (original), 95-99 (patched)
> > <https://reviews.apache.org/r/61797/diff/1/?file=1801032#file1801032line96>
> >
> > Maybe `return (result == 0) ? Nothing() : ErrnoError(result);`?
It looks more complex to me. I don't like that.
- Andrei
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61797/#review183460
-----------------------------------------------------------
On Aug. 21, 2017, 8:54 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61797/
> -----------------------------------------------------------
>
> (Updated Aug. 21, 2017, 8:54 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Benjamin Bannier, Benjamin Mahler, and James Peach.
>
>
> Bugs: MESOS-7791
> https://issues.apache.org/jira/browse/MESOS-7791
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Async-signal safe `write` function, which can take variable number of
> arguments, should be used to improve signal safety.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/os/write.hpp beb5bd83b52565a75e34d32b5bb17951bc799578
>
>
> Diff: https://reviews.apache.org/r/61797/diff/1/
>
>
> Testing
> -------
>
> sudo make check (mac os x, fedora 25)
> internal CI
>
>
> Thanks,
>
> Andrei Budnik
>
>
Re: Review Request 61797: Added async-signal safe implementation of
`write` function in stout.
Posted by Andrei Budnik <ab...@mesosphere.com>.
> On Aug. 22, 2017, 10:46 a.m., Alexander Rukletsov wrote:
> > 3rdparty/stout/include/stout/os/write.hpp
> > Lines 67 (patched)
> > <https://reviews.apache.org/r/61797/diff/1/?file=1801032#file1801032line68>
> >
> > `std::strlen`?
>
> Andrei Budnik wrote:
> I'm not sure if `std::strlen` is async-signal safe.
>
> Alexander Rukletsov wrote:
> It is the same function but properly namespaced.
Ok. Fixed.
- Andrei
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61797/#review183460
-----------------------------------------------------------
On Aug. 21, 2017, 8:54 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61797/
> -----------------------------------------------------------
>
> (Updated Aug. 21, 2017, 8:54 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Benjamin Bannier, Benjamin Mahler, and James Peach.
>
>
> Bugs: MESOS-7791
> https://issues.apache.org/jira/browse/MESOS-7791
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Async-signal safe `write` function, which can take variable number of
> arguments, should be used to improve signal safety.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/abort.hpp d3291dce8ec3db6141124e9cd231d34409998a18
> 3rdparty/stout/include/stout/os/write.hpp beb5bd83b52565a75e34d32b5bb17951bc799578
>
>
> Diff: https://reviews.apache.org/r/61797/diff/3/
>
>
> Testing
> -------
>
> sudo make check (mac os x, fedora 25)
> internal CI
>
>
> Thanks,
>
> Andrei Budnik
>
>
Re: Review Request 61797: Added async-signal safe implementation of
`write` function in stout.
Posted by Alexander Rukletsov <ru...@gmail.com>.
> On Aug. 22, 2017, 10:46 a.m., Alexander Rukletsov wrote:
> > 3rdparty/stout/include/stout/os/write.hpp
> > Lines 67 (patched)
> > <https://reviews.apache.org/r/61797/diff/1/?file=1801032#file1801032line68>
> >
> > `std::strlen`?
>
> Andrei Budnik wrote:
> I'm not sure if `std::strlen` is async-signal safe.
It is the same function but properly namespaced.
- Alexander
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61797/#review183460
-----------------------------------------------------------
On Aug. 21, 2017, 8:54 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61797/
> -----------------------------------------------------------
>
> (Updated Aug. 21, 2017, 8:54 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Benjamin Bannier, Benjamin Mahler, and James Peach.
>
>
> Bugs: MESOS-7791
> https://issues.apache.org/jira/browse/MESOS-7791
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Async-signal safe `write` function, which can take variable number of
> arguments, should be used to improve signal safety.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/abort.hpp d3291dce8ec3db6141124e9cd231d34409998a18
> 3rdparty/stout/include/stout/os/write.hpp beb5bd83b52565a75e34d32b5bb17951bc799578
>
>
> Diff: https://reviews.apache.org/r/61797/diff/2/
>
>
> Testing
> -------
>
> sudo make check (mac os x, fedora 25)
> internal CI
>
>
> Thanks,
>
> Andrei Budnik
>
>
Re: Review Request 61797: Added async-signal safe implementation of
`write` function in stout.
Posted by Alexander Rukletsov <ru...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61797/#review183460
-----------------------------------------------------------
3rdparty/stout/include/stout/os/write.hpp
Lines 67 (patched)
<https://reviews.apache.org/r/61797/#comment259472>
`std::strlen`?
3rdparty/stout/include/stout/os/write.hpp
Line 60 (original), 95-99 (patched)
<https://reviews.apache.org/r/61797/#comment259471>
Maybe `return (result == 0) ? Nothing() : ErrnoError(result);`?
- Alexander Rukletsov
On Aug. 21, 2017, 8:54 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61797/
> -----------------------------------------------------------
>
> (Updated Aug. 21, 2017, 8:54 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Benjamin Bannier, Benjamin Mahler, and James Peach.
>
>
> Bugs: MESOS-7791
> https://issues.apache.org/jira/browse/MESOS-7791
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Async-signal safe `write` function, which can take variable number of
> arguments, should be used to improve signal safety.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/os/write.hpp beb5bd83b52565a75e34d32b5bb17951bc799578
>
>
> Diff: https://reviews.apache.org/r/61797/diff/1/
>
>
> Testing
> -------
>
> sudo make check (mac os x, fedora 25)
> internal CI
>
>
> Thanks,
>
> Andrei Budnik
>
>