opened
abhishekshivanna
username_0
**Symptom:** 
When a container heartbeat fails, the container shutdown
sequence is triggered and the Container is never restarted.

**Cause:**
When a container heartbeat fails, the container shutdown
sequence exists the Container with an exit code of `0` which
marks the container as `Completed` - preventing the JobCoordinator
from restarting the container.

**Changes:** 
The container can shutdown exceptionally in the following two ways:
1) Exception in the container
2) Heartbeat Expired
In both paths the ContainerLaunchUtil previously expected a
shared static variable to hold the exception. The change introduced
gets rid of the static variable and checks each path explicitly
and exits with code `1` in both cases.
SAMZA-2423: Heartbeat failure causes incorrect container shutdown
issue
created
mynameborat
username_1
Seems like the bug is we end up overwriting the `containerException` with `listener.getContainerException` without checking if it has already been populated. Due to this, it is possible that container listener doesn't have any exception because it was requested to shut itself down but the request was due to expired heartbeat. 

Is that correct?
comment
created
abhishekshivanna
username_0
@username_1 Correct !
comment
created
mynameborat
username_1
can we add a unit test for this?
comment
created
mynameborat
username_1
comment
created
abhishekshivanna
username_0
I agree, looks like there is no way to mock objects that `ContainerLaunchUtil` instantiates in order to test this.
comment