[
https://issues.apache.org/jira/browse/MESOS-8575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16368080#comment-16368080
]
Greg Mann commented on MESOS-8575:
----------------------------------
I have a WIP patch posted above, but I want to think carefully about the
correct discard semantics for the Docker library calls.
One question: when the caller of `Docker::stop`, `Docker::inspect`, or
`Docker::pull` discards the `Future` returned by those functions, what do we
expect to happen to the `Promise` associated with that `Future`?
The way that `inspect()` is implemented, we end up with the following semantics:
* when the caller of `Docker::inspect()` discards the returned `Future`, the
`Promise` backing that `Future` is also discarded, so the caller can rely on
the `Future` never becoming failed or satisfied.
It seems to me, that behavior would work well for the Docker executor case. for
example, if the executor discards the `Future` associated with `inspect`, it
doesn’t want the future to subsequently transition to the failed state, which
could end up running an `onFailed` or `onAny` callback in the executor.
similarly, i think the executor would benefit from those same semantics in the
case of `Docker::stop`, so that if the executor discards the `stop` future, it
can rely on that future never being failed, so that an `onFailed` callback like
this would not be invoked:
https://github.com/apache/mesos/blob/3def7fea56ffbe1950092c0f79c056bbc2559164/src/docker/executor.cpp#L510-L525
However, the current implementations of `Docker::stop` and `Docker::pull` will
require a more significant refactor if we want them to produce this behavior.
AFAICT, they would need to create a `Promise` which they pass through to each
continuation, the way `Docker::inspect` does currently. as `Docker::stop` and
`Docker::pull` are written right now, when the caller discards the returned
future, the `onDiscard` handler will kill a subprocess, which will satisfy the
`s.status()` future, leading to a continuation being invoked with a nonzero
status code, which could lead to the returned future entering the failed state.
> Add discard handling to the Docker library
> ------------------------------------------
>
> Key: MESOS-8575
> URL: https://issues.apache.org/jira/browse/MESOS-8575
> Project: Mesos
> Issue Type: Improvement
> Affects Versions: 1.5.0
> Reporter: Greg Mann
> Assignee: Greg Mann
> Priority: Major
> Labels: mesosphere
>
> The functions in the Docker library which issue Docker CLI commands should be
> updated so that when the {{Future}} they return is discarded, any
> subprocesses which have been spawned will be cleaned up.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)