The sync_state variable was out of scope for non-zero ranks, causing them to use an old sync_state value from an earlier loop iteration. Now properly initialize and use master_addr variable in both branches. Co-Authored-By: Claude <noreply@anthropic.com>