Solve the race condition between task and SlaveNode