You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Neil Conway <ne...@gmail.com> on 2016/04/11 16:04:36 UTC
Review Request 46024: Avoided misleading locking in the libprocess
SocketManager.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46024/
-----------------------------------------------------------
Review request for mesos and Ben Mahler.
Repository: mesos
Description
-------
In `SocketManager::swap_implementing_socket`, the previous coding
accessed the `sockets` instance variable in two CHECKs without
acquiring `mutex`. This is unsafe in general: `mutex` should be
acquired before accessing instance variables like `sockets` (unless
you know all such concurrent accesses will be read-only etc.).
As it happens, the previous coding was not unsafe because all the
call-sites of `SocketManager::swap_implementing_socket` acquire
`mutex` before invoking it. But because `swap_implementing_socket`
also acquires `mutex`, clearly its API contract allows it to be
invoked without holding `mutex`, in which case the CHECKs would
likely be unsafe.
Diffs
-----
3rdparty/libprocess/src/process.cpp 5e9dcfdc52f3a8223bc43af149b8e1f5dbdf5b0a
Diff: https://reviews.apache.org/r/46024/diff/
Testing
-------
Thanks,
Neil Conway
Re: Review Request 46024: Avoided misleading locking in the libprocess
SocketManager.
Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46024/#review128319
-----------------------------------------------------------
Ship it!
Ship It!
- Ben Mahler
On April 11, 2016, 2:36 p.m., Neil Conway wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46024/
> -----------------------------------------------------------
>
> (Updated April 11, 2016, 2:36 p.m.)
>
>
> Review request for mesos and Ben Mahler.
>
>
> Repository: mesos
>
>
> Description
> -------
>
> In `SocketManager::swap_implementing_socket`, the previous coding
> accessed the `sockets` instance variable in two CHECKs without
> acquiring `mutex`. This is unsafe in general: `mutex` should be
> acquired before accessing instance variables like `sockets` (unless
> you know all such concurrent accesses will be read-only etc.).
>
> As it happens, the previous coding was not unsafe because all the
> call-sites of `SocketManager::swap_implementing_socket` acquire
> `mutex` before invoking it. But because `swap_implementing_socket`
> also acquires `mutex`, clearly its API contract allows it to be
> invoked without holding `mutex`, in which case the CHECKs would
> likely be unsafe.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/src/process.cpp 5e9dcfdc52f3a8223bc43af149b8e1f5dbdf5b0a
>
> Diff: https://reviews.apache.org/r/46024/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Neil Conway
>
>
Re: Review Request 46024: Avoided misleading locking in the libprocess
SocketManager.
Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46024/#review128271
-----------------------------------------------------------
Mind adding joris and/or benh as reviewers? I'm happy to review but since they wrote the code I'd like them to be aware of this change.
- Ben Mahler
On April 11, 2016, 2:36 p.m., Neil Conway wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46024/
> -----------------------------------------------------------
>
> (Updated April 11, 2016, 2:36 p.m.)
>
>
> Review request for mesos and Ben Mahler.
>
>
> Repository: mesos
>
>
> Description
> -------
>
> In `SocketManager::swap_implementing_socket`, the previous coding
> accessed the `sockets` instance variable in two CHECKs without
> acquiring `mutex`. This is unsafe in general: `mutex` should be
> acquired before accessing instance variables like `sockets` (unless
> you know all such concurrent accesses will be read-only etc.).
>
> As it happens, the previous coding was not unsafe because all the
> call-sites of `SocketManager::swap_implementing_socket` acquire
> `mutex` before invoking it. But because `swap_implementing_socket`
> also acquires `mutex`, clearly its API contract allows it to be
> invoked without holding `mutex`, in which case the CHECKs would
> likely be unsafe.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/src/process.cpp 5e9dcfdc52f3a8223bc43af149b8e1f5dbdf5b0a
>
> Diff: https://reviews.apache.org/r/46024/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Neil Conway
>
>
Re: Review Request 46024: Avoided misleading locking in the libprocess
SocketManager.
Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46024/#review128220
-----------------------------------------------------------
Patch looks great!
Reviews applied: [46025, 46026, 46027, 46028, 46029, 46030, 46024]
Passed command: export OS='ubuntu:14.04' CONFIGURATION='--verbose' COMPILER='gcc' ENVIRONMENT='GLOG_v=1 MESOS_VERBOSE=1'; ./support/docker_build.sh
- Mesos ReviewBot
On April 11, 2016, 2:36 p.m., Neil Conway wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46024/
> -----------------------------------------------------------
>
> (Updated April 11, 2016, 2:36 p.m.)
>
>
> Review request for mesos and Ben Mahler.
>
>
> Repository: mesos
>
>
> Description
> -------
>
> In `SocketManager::swap_implementing_socket`, the previous coding
> accessed the `sockets` instance variable in two CHECKs without
> acquiring `mutex`. This is unsafe in general: `mutex` should be
> acquired before accessing instance variables like `sockets` (unless
> you know all such concurrent accesses will be read-only etc.).
>
> As it happens, the previous coding was not unsafe because all the
> call-sites of `SocketManager::swap_implementing_socket` acquire
> `mutex` before invoking it. But because `swap_implementing_socket`
> also acquires `mutex`, clearly its API contract allows it to be
> invoked without holding `mutex`, in which case the CHECKs would
> likely be unsafe.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/src/process.cpp 5e9dcfdc52f3a8223bc43af149b8e1f5dbdf5b0a
>
> Diff: https://reviews.apache.org/r/46024/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Neil Conway
>
>
Re: Review Request 46024: Avoided misleading locking in the libprocess
SocketManager.
Posted by Neil Conway <ne...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46024/
-----------------------------------------------------------
(Updated April 11, 2016, 2:36 p.m.)
Review request for mesos and Ben Mahler.
Repository: mesos
Description
-------
In `SocketManager::swap_implementing_socket`, the previous coding
accessed the `sockets` instance variable in two CHECKs without
acquiring `mutex`. This is unsafe in general: `mutex` should be
acquired before accessing instance variables like `sockets` (unless
you know all such concurrent accesses will be read-only etc.).
As it happens, the previous coding was not unsafe because all the
call-sites of `SocketManager::swap_implementing_socket` acquire
`mutex` before invoking it. But because `swap_implementing_socket`
also acquires `mutex`, clearly its API contract allows it to be
invoked without holding `mutex`, in which case the CHECKs would
likely be unsafe.
Diffs (updated)
-----
3rdparty/libprocess/src/process.cpp 5e9dcfdc52f3a8223bc43af149b8e1f5dbdf5b0a
Diff: https://reviews.apache.org/r/46024/diff/
Testing
-------
Thanks,
Neil Conway