Skip to content

revokeWithRetry has no backoff and only catches IOException #68

@nficano

Description

@nficano

ARCPRuntime.revokeWithRetry at lib/src/main/kotlin/dev/arcp/runtime/ARCPRuntime.kt:384 retries provisioner.revoke up to three times immediately back-to-back, with no delay between attempts, so a transient provider failure burns all retries inside a few milliseconds. The catch block at lib/src/main/kotlin/dev/arcp/runtime/ARCPRuntime.kt:393 also only handles IOException; any other exception type a provisioner might raise — ARCPException.Unavailable, IllegalStateException, the upstream HTTP library's own exception types — propagates out of the loop. Because revokeWithRetry is launched from the init block at lib/src/main/kotlin/dev/arcp/runtime/ARCPRuntime.kt:115 and from terminalCleanup, an uncaught exception bubbles up to the SupervisorJob and is swallowed silently, so the operator sees nothing.

Fix prompt: Add an exponential backoff between attempts (for example delay(initialDelay * 2.0.pow(attempt)) capped at a few seconds) and use withTimeout to bound total time spent on a single revocation. Broaden the catch to Exception (re-throwing CancellationException), log every failure with the credential id at warn level, and on final failure either move the credential to a "manual cleanup" channel or let the provisioner's pendingRevocations() reflect the retry intent. Add a CredentialProvisionerTest case that throws a non-IO exception and asserts the runtime logs but does not crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-qualityCode-quality / idiomatic improvementseverity:lowLow severity issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions