While rebalancing ProcessorNode.close() can be called twice, once from StreamThread.suspendTasksAndState() and once from StreamThread.closeNonAssignedSuspendedTasks(). If ProcessorNode.close() throws some exception because of calling close() multiple times( i.e. IllegalStateException from some KafkaConsumer instance being used by some processor for some lookup), we fail to close the task's state manager ( i.e. call to task.closeStateManager(true); fails). After rebalance, if the same task id is launched on same application instance but in different thread then the task get stuck because it fails to get lock to the task's state directory.
Since processor close() is already called from StreamThread.suspendTasksAndState() we don't need to call again from StreamThread.closeNonAssignedSuspendedTasks().