beam icon indicating copy to clipboard operation
beam copied to clipboard

[Feature Request]: RequestResponseIO: Unable to configure retry Backoff parameters; defaults to unlimited retries

Open jigarkb opened this issue 11 months ago • 4 comments

What would you like to happen?

Note: This is only applicable if we fix this: https://github.com/apache/beam/issues/37176

Problem: The RequestResponseIO transform currently hardcodes the retry backoff strategy to FluentBackoff.DEFAULT. This default strategy does not impose a limit on the number of retries or the total duration, effectively leading to unlimited retries for retryable errors (UserCodeRemoteSystemException, UserCodeTimeoutException).

Limitation: Users currently cannot override this behavior because the method responsible for configuring the backoff strategy is package-private

Impact: In production environments, unlimited retries are dangerous as they can cause pipelines to get stuck indefinitely on persistent errors or create backpressure issues. Users need the ability to define bounds

Location: https://github.com/apache/beam/blob/v2.67.0/sdks/java/io/rrio/src/main/java/org/apache/beam/io/requestresponse/RequestResponseIO.java#L225-L235

Current Code:

RequestResponseIO<RequestT, ResponseT> withBackOffSupplier(SerializableSupplier<BackOff> value) {
    return new RequestResponseIO<>(
        rrioConfiguration, callConfiguration.toBuilder().setBackOffSupplier(value).build());
  }

Suggested Fix:

public RequestResponseIO<RequestT, ResponseT> withBackOffSupplier(SerializableSupplier<BackOff> value) {
        return new RequestResponseIO<>(
                rrioConfiguration, callConfiguration.toBuilder().setBackOffSupplier(value).build());
    }

Issue Priority

Priority: 2 (default / most feature requests should be filed as P2)

Issue Components

  • [ ] Component: Python SDK
  • [ ] Component: Java SDK
  • [ ] Component: Go SDK
  • [ ] Component: Typescript SDK
  • [x] Component: IO connector
  • [ ] Component: Beam YAML
  • [ ] Component: Beam examples
  • [ ] Component: Beam playground
  • [ ] Component: Beam katas
  • [ ] Component: Website
  • [ ] Component: Infrastructure
  • [ ] Component: Spark Runner
  • [ ] Component: Flink Runner
  • [ ] Component: Samza Runner
  • [ ] Component: Twister2 Runner
  • [ ] Component: Hazelcast Jet Runner
  • [ ] Component: Google Cloud Dataflow Runner

jigarkb avatar Dec 29 '25 20:12 jigarkb

Hi — I can take this on. Please assign this issue to @ML-dev-crypto.

Proposed fix

Change the visibility of RequestResponseIO.withBackOffSupplier(...) from package-private to public so callers can set a custom BackOff supplier (for example, one that bounds retries by count or total time). Add unit tests verifying the supplier is stored and honored; add an integration-style test that demonstrates bounded retries stop after the configured limit. Add a short release-note / docs comment mentioning this API addition and link to this issue and #37176. Why

The current package-private visibility prevents users from overriding the default FluentBackoff.DEFAULT (which has no bounds), causing effectively unlimited retries for retryable errors. Making the method public is the smallest, least-invasive change to let users supply a bounded backoff strategy. API change (minimal)

Visibility change only: package-private -> public No behavioral change unless users call the new API Proposed PR title RequestResponseIO: make withBackOffSupplier public to allow bounded retry strategies (#37198)

Proposed PR description

Make RequestResponseIO.withBackOffSupplier public so callers can provide a SerializableSupplier. Add unit tests to validate the configured supplier is used and a bounded BackOff stops retrying. Reference #37198 and #37176 in the PR description. Note compatibility: API addition only (no breaking changes).

ML-dev-crypto avatar Jan 16 '26 19:01 ML-dev-crypto

Hi, I'd like to work on this issue together with #37176. I'll add configurable retry backoff parameters to RequestResponseIO.

PDGGK avatar Jan 18 '26 07:01 PDGGK

Hi @ML-dev-crypto, I see you claimed this 2 days ago. Are you actively working on it? I've also started investigating #37176 (the exception wrapping bug), which is related. If you're still working on #37198, I can focus on #37176 first and we can coordinate. Let me know!

PDGGK avatar Jan 18 '26 07:01 PDGGK

.take-issue

I've submitted PR #37356 to fix this issue.

PDGGK avatar Jan 23 '26 08:01 PDGGK