Retry-After parser accepts invalid delay-seconds values

Open Beginner friendly
#9,018 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@Dhruvraj-Rana is already working on this.

Since Nov 8, 2026.

  • #9019 by @Dhruvraj-Rana — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

Start with RetryUtil.retryAfterNanos and its existing tests in io.opentelemetry.exporter.internal.RetryUtilTest. Check how the parser handles +30, -0, and ٣٠, then run that test class. Done means each malformed value returns OptionalLong.empty() while valid ASCII delay-seconds values continue to parse.

Written by the indexing model from the issue text.

Description

Bug

Describe the bug

The internal RetryUtil.retryAfterNanos parser accepts +30 as a 30-second delay and -0 as zero. Long.parseLong also accepts non-ASCII decimal digits. These values do not match the HTTP Retry-After delay-seconds grammar (1*DIGIT, ASCII 0–9).

The JDK and OkHttp HTTP senders use this parser. An accepted malformed value overrides their ordinary retry backoff instead of being ignored.

Steps to reproduce

In the existing io.opentelemetry.exporter.internal.RetryUtilTest, pass +30, -0, or ٣٠ to RetryUtil.retryAfterNanos(value, Instant.EPOCH).

What did you expect to see?

OptionalLong.empty(), as for other malformed values, so the ordinary retry policy applies.

What did you see instead?

OptionalLong.of(30000000000L) for +30; OptionalLong.of(0L) for -0; non-ASCII decimal digits are also parsed as a delay.

What version and what artifacts are you using?

Artifacts: exporters/common (used by the JDK and OkHttp senders)
Version: source checkout at f02bddc
How referenced: direct source checkout

Environment

Compiler: Temurin 25.0.5
OS: macOS 15.5

Additional context

The HTTP grammar is defined in RFC 9110 section 10.2.3.

Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
4d 3h
Merged PRs (30d)
49

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-telemetry/opentelemetry-java

All issues in open-telemetry/opentelemetry-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.