[
https://issues.apache.org/jira/browse/MESOS-6234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15530852#comment-15530852
]
Joseph Wu commented on MESOS-6234:
----------------------------------
{code}
commit 3b27c92f9b31d9b40c86f368ebd30c97d4fb69e8
Author: Joseph Wu <[email protected]>
Date: Wed Sep 28 12:33:47 2016 -0700
Added synchronization in link logic to prevent relinking races.
There is a general pattern in the `SocketManager` in which most methods
will grab the mutex and then check if the socket to manage exists in
the `SocketManager`s mapping. If the socket does not exist, the
`SocketManager` silently returns.
This adds similar logic inside two critical sections of the `link`
codepath. If there are multiple calls to `link` in-flight at once,
this prevents sockets from being leaked into unmanaged callback loops.
Review: https://reviews.apache.org/r/52181/
{code}
> Potential socket leak during Zookeeper network changes
> ------------------------------------------------------
>
> Key: MESOS-6234
> URL: https://issues.apache.org/jira/browse/MESOS-6234
> Project: Mesos
> Issue Type: Bug
> Components: libprocess
> Affects Versions: 0.28.3, 1.0.0
> Reporter: Joseph Wu
> Assignee: Joseph Wu
> Labels: libprocess, mesosphere
> Fix For: 0.28.3, 1.1.0, 1.0.2
>
>
> There is a potential leak when using the version of {{link}} with
> {{RemoteConnection::RECONNECT}}. This was originally implemented to refresh
> links during master recovery.
> The leak occurs here:
> https://github.com/apache/mesos/blob/5e23edd513caec51ce3e94b3d785d714052525e8/3rdparty/libprocess/src/process.cpp#L1592-L1597
> ^ The comment here is not correct, as that is *not* the last reference to the
> {{existing}} socket.
> At this point, the {{existing}} socket may be a perfectly valid link. Valid
> links will all have a reference inside a callback loop created here:
> https://github.com/apache/mesos/blob/5e23edd513caec51ce3e94b3d785d714052525e8/3rdparty/libprocess/src/process.cpp#L1503-L1509
> -----
> We need to stop the callback loop but prevent any resulting {{ExitedEvents}}
> from being sent due to stopping the callback loop. This means discarding the
> callback loop's future after we have called {{swap_implementing_socket}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)