Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

[FLINK-41798][runtime] Fix long overflow in exponential-delay restart backoff - #30247

Open
cjohnson-confluent wants to merge 1 commit into
apache:masterfrom
confluentinc:cjohnson/FLINK-41798
Open

cjohnson-confluent wants to merge 1 commit into
apache:masterfrom
confluentinc:cjohnson/FLINK-41798

Conversation

@cjohnson-confluent

Copy link
Copy Markdown
Contributor

What is the purpose of the change

After enough restart attempts, ExponentialDelayRestartBackoffTimeStrategy computes a backoff plus jitter that overflows long. The negative result is clamped to the initial backoff, so a job that keeps failing alternates between the initial and the max backoff instead of staying at the max. With jitter-factor 1.0, offset + 1 overflows and ThreadLocalRandom.nextLong throws IllegalArgumentException.

Brief change log

  • Saturate currentBackoffTime + jitter at Long.MAX_VALUE before clamping to the max backoff.
  • Use an exclusive upper bound of offset instead of offset + 1 when the jitter offset is Long.MAX_VALUE.

Verifying this change

This change added tests and can be verified as follows:

  • testBackoffStaysAtMaxAfterManyAttempts: 200 attempts with initial 1 s, max 5 min, multiplier 2, jitter 0.1; from attempt 9 on the backoff must equal the max. Fails on master at attempt 53 (1000 instead of 300000).
  • testFullJitterAfterManyAttempts: same with jitter 1.0; the backoff must stay within [initial, max]. Throws IllegalArgumentException on master.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: yes (restart backoff of the JobManager scheduler)
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Opus 5.5

… backoff

After enough restart attempts, the backoff plus a positive jitter
overflowed to a negative value and was clamped to the initial backoff, so
a job in a persistent failure loop alternated between the initial and the
max backoff. With jitter-factor 1.0, offset + 1 overflowed and
ThreadLocalRandom.nextLong threw IllegalArgumentException.

Saturate the sum at Long.MAX_VALUE and avoid offset + 1 at Long.MAX_VALUE.

Generated-by: Claude Opus 5.5
@flinkbot

flinkbot commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

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