Skip to content

popm: exponential backoff overflow #664

@AL-CT

Description

@AL-CT

Confirmation

  • I have checked for similar issues.

Describe the bug

PR #612 added logic for exponential backoff to popm. However, the method used (byte-shifting), will eventually force delay to overflow, leading to delay being set to a negative number (preventing Tick() from ever continuing) or even 0:

delay := baseDelay * (1 << attempt)
if delay > maxDelay {
	delay = maxDelay
}

This is exacerbated by the jitter code, which will panic once the argument for Int64N() becomes too high:

jitter := int64(delay / 10)
delay += time.Duration(mathrand.Int64N(jitter*2) - jitter)

Expected behaviour

popm should retry indefinitely without any issues

Environment

Version:
Operating System:
Architecture:

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: popmThis is a change to popm (PoP Miner)type: bugThis is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions