azure-container-networking
azure-container-networking copied to clipboard
fix: delete cni statefile when unable to be parsed
Reason for Change:
Sometimes in certain scenarios (usually windows), if there is a crash of the OS, null bytes may be written to the state and log file. When the CNI tries to restore the state, it is unable to read the statefile and fails. All subsequent retries will fail as the state is irrecoverable. This PR changes this behavior to delete the entire cni statefile if there is a syntax error (ex: if there are a bunch of null bytes in the file), as manual intervention would be needed to recover anyway. The null statefile issue only seems to appear on the pipelines on windows nodes.
Issue Fixed:
See above
Requirements:
- [X] uses conventional commit messages
- [ ] includes documentation
- [x] adds unit tests
- [X] relevant PR labels added
Notes: This issue appears sporadically