Skip to content

fix(net): stop reporting temporary capacity pressure as 416 - #3370

Open
awaae001 wants to merge 2 commits into
OpenListTeam:mainfrom
awaae001:fix/range-open-error-status
Open

awaae001 wants to merge 2 commits into
OpenListTeam:mainfrom
awaae001:fix/range-open-error-status

Conversation

@awaae001

@awaae001 awaae001 commented Dec 1, 2026

Copy link
Copy Markdown
Member

在以前的实现中(参见 893457c fix(aliyundrive): limit callback concurrency (#3071)) PR ,此 PR 补上用并发 Range 读取的aliyun 盘返回错误的问题,它修复了 S3 ,具体修复了什么此处不再赘述。但是这个 PR 的 503 映射只服务了 S3 端口,并未服务 webdav 等原始路径,默认分支就是 416。

所以 PR 自己定的「容量压力 ≠ 永久错误」在 WebDAV 上是失效的,backrest 就是这么中招的 :D

驱动返回的 TemporaryCapacity 不属于 HttpStatusCodeError,因此被写成 416。416 的语义是「你要的 Range 不存在」,restic 收到后会当成对象层面的错误,不去重试。

  • This PR has breaking changes.
    / 此 PR 包含破坏性变更。
  • This PR changes public API, config, storage format, or migration behavior.
    / 此 PR 修改了公开 API、配置、存储格式或迁移行为。
  • This PR requires corresponding changes in related repositories.
    / 此 PR 需要关联仓库同步修改。

现在ServeHTTP 的错误映射能正常处理这个错误,返回 503 和 Retry after,其他打开失败返回 500 。

restic 拿到 503 会退避重试,而不是判定包坏了。对于check/prune 不再因为并发抢不到许可就整体失败。真正越界的 Range 还是 416

Testing / 测试

  • go test ./...
  • Manual test / 手动测试:

Checklist / 检查清单

  • I have read CONTRIBUTING.
    / 我已阅读 CONTRIBUTING。
  • I confirm this contribution follows the repository license, contribution policy, and code of conduct.
    / 我确认此贡献符合仓库许可证、贡献规范和行为准则。
  • I have formatted the changed code with gofmt, go fmt, or prettier where applicable.
    / 我已按适用情况使用 gofmt、go fmt 或 prettier 格式化变更代码。
  • I have requested review from relevant maintainers or code owners where applicable.
    / 我已在适用情况下请求相关维护者或代码所有者审查。

AI Disclosure / AI 使用声明

  • This PR includes AI-assisted content.
    / 此 PR 包含 AI 辅助内容。

Tools used / 使用工具:

  • ChatGPT
  • Codex
  • GitHub Copilot
  • Claude
  • Gemini
  • Other (please specify) / 其他(请注明):

我使用了 claude Opus 5-5 审查可能的错误范围,并对齐进行修复后使用 DeepSeek 4.1 1017 进行 PR 编写引导。

  • I have reviewed and validated all AI-assisted content included in this PR.
    / 我已审核并验证此 PR 中的所有 AI 辅助内容。
  • I have ensured that all AI-assisted commits include Co-Authored-By attribution.
    / 我已确保所有 AI 辅助提交都包含 Co-Authored-By 归属信息。
  • I can reproduce all AI-assisted content included in this PR without any AI tools.
    / 我可以在没有任何 AI 工具的情况下重现此 PR 中包含的所有 AI 辅助内容。

- Extract range open error handling into `writeRangeOpenError` helper
- Return `503 Service Unavailable` with `Retry-After: 1` for `errs.TemporaryCapacity` errors
- Default to `500 Internal Server Error` instead of `416` when no HTTP status code error is present
- Preserve existing `HttpStatusCodeError` status code behavior
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.

1 participant