Description
The shouldRetry(int errorCode) in ContainerImpl with YARN-5015 also updated some fields in retry context- remaining retries, restart times.
This method is directly called from outside the ContainerImpl class as well- ContainerLaunch.setContainerCompletedStatus. This causes following problems:
- remainingRetries are updated more than once after a failure. if maxRetries = 1, then a retry will not be triggered because of multiple calls to shouldRetry(int errorCode).
- Writes to retryContext should be protected and called when the write lock is held.