Skip to content

fix: add retry with exp backoff to action plugins#167

Merged
jkupferer merged 3 commits intomainfrom
fix-error-handling-transient-k8s
Mar 27, 2026
Merged

fix: add retry with exp backoff to action plugins#167
jkupferer merged 3 commits intomainfrom
fix-error-handling-transient-k8s

Conversation

@fridim
Copy link
Copy Markdown
Contributor

@fridim fridim commented Mar 16, 2026

The anarchy_subject_update and anarchy_schedule_action plugins call response.json() without error handling. When the anarchy API returns an empty body or a non-JSON response due to transient issues, json.loads("") raises JSONDecodeError: "Expecting value: line 1 column 1 (char 0)". This causes intermittent provision failures that succeed on retry.

  • Add retry loop (3 attempts, exponential backoff: 5s, 10s)
  • Add response.raise_for_status() before parsing JSON
  • Catch RequestException, ValueError, and KeyError
  • Log warnings on each failed attempt via ansible display
  • Return actionable error message when all retries exhausted

The anarchy_subject_update and anarchy_schedule_action plugins
call response.json() without error handling. When the anarchy
API returns an empty body or a non-JSON response due to
transient issues, json.loads("") raises JSONDecodeError:
"Expecting value: line 1 column 1 (char 0)". This causes
intermittent provision failures that succeed on retry.

- Add retry loop (3 attempts, exponential backoff: 5s, 10s)
- Add response.raise_for_status() before parsing JSON
- Catch RequestException, ValueError, and KeyError
- Log warnings on each failed attempt via ansible display
- Return actionable error message when all retries exhausted
@fridim fridim requested a review from jkupferer March 16, 2026 13:53
- Update to latest kopf
- Fix tests for updated ansible
- Fix a few logging statements
@jkupferer jkupferer merged commit 2f129ac into main Mar 27, 2026
@jkupferer jkupferer deleted the fix-error-handling-transient-k8s branch March 27, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants