Github user mcgilman commented on the issue:
https://github.com/apache/nifi/pull/2646
@markap14 I see. It appears then that the underlying issue is that either
(1) the stateChange method is not being invoked or (2) the leader thread
interruption is not happening/working. We could include your proposed changes
and update our implementation of stateChanged to set `leader` to false when the
`newState` is LOST or SUSPENDED before invoking super. Additionally, in
`takeLeadership` we should loop while not stopped and is leader. This should
help if the underlying issue was (2) while the polling could act as additional
insurance.
---