ExposedTransactionRunner: Exposed's default 3x retry re-runs claim+delivery on SQLException, multiplying duplicate deliveries
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with ExposedTransactionRunner.runInTransaction in the okapi-exposed module, which wraps the block in Exposed's transaction(database), and with processNext() to see the claim, deliver, update sequence. Check how Exposed's DatabaseConfig retry setting reaches that call. Done when a test shows the deliverer is invoked once when the store update throws SQLException, and the existing tests still pass.
由索引模型根据 Issue 内容生成。
描述
Severity: Medium (duplicate delivery amplification) · Area: okapi-exposed ExposedTransactionRunner · Found in: code review of main @ e5630a1
Problem
ExposedTransactionRunner.runInTransaction is transaction(database) { block() }. Exposed retries the entire block on SQLException up to DatabaseConfig.defaultMaxAttempts times. The default is 3, which I confirmed in the bytecode of exposed-core 1.6.0.
For the outbox scheduler the block is processNext(): claim → network delivery → update. If the update or commit fails with an SQLException (deadlock victim, serialization failure, connection reset, oversized last_error, see the related issue), Exposed rolls back and re-runs the whole cycle immediately. It re-claims the same rows and delivers them again, up to 3 times per tick, with no backoff. The delivery side effect isn't transactional, so these retries only add duplicates and load on the downstream.
The purger and the metrics reads are idempotent, so retries are harmless there. The processor path is the problem.
Suggested fix
Disable Exposed's automatic retry for okapi's runner, e.g. transaction(database) { maxAttempts = 1; block() } (or the equivalent DatabaseConfig), and let okapi's own scheduler retry on the next tick. Add a test asserting that a deliverer is invoked once when the store update throws SQLException.
- 主要语言
- Kotlin
- 星标
- 14
- 派生
- 0
- 平均合并
- 9 小时 54 分钟
- 30 天内合并 PR
- 11
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
softwaremill/okapi 的其他 Issue
-
bug
难度 5/5 一周以上 新手友好度 35/100
softwaremill/okapi#141 ·
维护者通常 1 天内回复
-
OutboxProcessorListener events are emitted before the transaction commits; metrics over-count on commit failure可能已有人在做 @rawo 今天认领。 未关闭breaking-change bug
难度 4/5 3-5 天 新手友好度 35/100
softwaremill/okapi#137 ·
维护者通常 1 天内回复
-
enhancement
难度 4/5 1-2 天 新手友好度 42/100
softwaremill/okapi#136 ·
维护者通常 1 天内回复
-
breaking-change bug
难度 4/5 3-5 天 新手友好度 35/100
softwaremill/okapi#135 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 22/100
softwaremill/okapi#133 ·
维护者通常 1 天内回复
查看 softwaremill/okapi 的全部 Issue
相似的 Issue
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
难度 2/5 1-3 小时 新手友好度 77/100
airbytehq/airbyte#91201 · 1 条评论 ·
维护者通常 1 天内回复
-
bug javascript
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
Source: c7 Type: bug
难度 2/5 1-3 小时 新手友好度 72/100
-
2.23
难度 2/5 1-3 小时 新手友好度 65/100
ankidroid/Anki-Android#23042 · 4 条评论 ·
维护者通常 1 天内回复
-
submit-adaption submit-adaption-pre
难度 1/5 1 小时以内 新手友好度 88/100
BetterAndroid/android-notification-icon-project#828 · 1 条评论 ·
维护者通常 1 天内回复