Retry-After parser accepts invalid delay-seconds values

未关闭 适合新手
#9,018 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@Dhruvraj-Rana 已经在做这个了。

开始于 2026年11月8日。

  • #9019 来自 @Dhruvraj-Rana —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java

调研方向

从 RetryUtil.retryAfterNanos 及其在 io.opentelemetry.exporter.internal.RetryUtilTest 中的现有测试开始。检查解析器如何处理 +30、-0 和 ٣٠,然后运行该测试类。完成标准是每个格式错误的值都返回 OptionalLong.empty(),而有效的 ASCII 延迟秒数值仍能继续解析。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Java
星标
2.5k
派生
1k
平均合并
4 天 3 小时
30 天内合并 PR
49

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

open-telemetry/opentelemetry-java 的其他 Issue

查看 open-telemetry/opentelemetry-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。