Details
Description
This is the sequence of events:
1) Default executor launches a nested container
2) Default executor invokes agent API WAIT_NESTED_CONTAINER
3) Default executor is killed
4) The connection to the agent for WAIT_NESTED_CONTAINER breaks
5) libprocess discard the future, which propagates to the code here.
6) `termination.future()` has the discard flag being set to true (i.e., hasDiscard() == true).
7) Default executor termination triggers container destroy for the nested container
8) When the destroy of the nested container is done, the control will reach here.
9) In the thenf handler for 'termination.future()', since `termination.future()` has discard flag set (hasDiscard() == true), we'll call promise->discard(), which cause the returned future to be in DISCARDED state.
10) The top level container destroy will fail because nested container destroy failed
11) This cause all isolator cleanup for the top level container not being called (e.g., CNI detach).