Delivery I/O runs inside the claim transaction: pool starvation, idle-in-transaction kills cause infinite redelivery, MVCC bloat
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 22/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- kafka, kotlin, mysql, postgresql
- Bereich
- backend, databases, distributed-systems
Rechercherichtung
Start with the KDoc on CompositeMessageDeliverer, which acknowledges the open transaction, and trace where the claim, delivery and status update share one transaction. Check the hard-coded CONNECT_TIMEOUT and REQUEST_TIMEOUT and the concurrency setting against the pool size. Done means the maintainers have agreed on the lease-based claim design or the startup guard, with tests covering a delivery that outlives the server's idle timeout.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Severity: Medium-High (pool starvation, duplicate-delivery loop, DB bloat) · Area: processor transaction design · Found in: code review of main @ e5630a1
Problem
The whole cycle (claim with FOR UPDATE SKIP LOCKED → network delivery → status update) runs in one DB transaction, so a pooled connection sits idle in transaction for as long as the transport I/O takes:
- HTTP: up to 10 s connect + 30 s request timeout (hard-coded
CONNECT_TIMEOUT/REQUEST_TIMEOUT, not configurable) - Kafka:
producer.flush()blocks up todelivery.timeout.ms(120 s default)
Concrete failure modes:
- Connection-pool starvation.
concurrencyaccepts values up to 256, and each worker holds one connection for the full delivery. Nothing checks this against the pool size: Hikari's default is 10. Withconcurrency >= pool sizeand a slow downstream, okapi takes every connection and the application's own requests time out ongetConnection(). - Infinite duplicate loop under server-side timeouts. With Postgres
idle_in_transaction_session_timeout, or a MySQLwait_timeout/proxy idle timeout shorter than the delivery time, the server kills the session mid-delivery. The final update/commit fails, and every entry that was actually delivered reverts toPENDINGwithretriesunchanged. It is delivered again on the next tick, killed again, and so on for as long as the downstream stays slow.retriesnever advances, so nothing ever reachesFAILED. - MVCC bloat (Postgres). Long transactions hold back the xmin horizon on what is by design a very high-churn table (every row is inserted, then updated, then deleted), which degrades vacuum for the entire database.
- Combined with the MySQL gap-lock issue, publishers are blocked for the same duration.
The KDoc on CompositeMessageDeliverer acknowledges the open transaction, but the consequences above aren't documented or guarded against.
Suggested fix
- Preferred: a lease-based claim. In a short transaction, mark rows
PROCESSINGwithlocked_until = now + leaseTimeout(or bump aclaim_token), commit, deliver outside any transaction, then write results in a second short transaction guarded by the claim token. A reaper (or the claim query itself) reclaims rows whose lease has expired. - At minimum: fail fast or warn at startup when
concurrency≥ the pool's maximum size; make the HTTP timeouts configurable; document the required relationship between delivery timeouts andidle_in_transaction_session_timeout/lock-wait timeouts.
- Vorherrschende Sprache
- Kotlin
- Sterne
- 14
- Forks
- 0
- Ø Merge
- 9 Std. 54 Min.
- Gemergte PRs (30 T.)
- 11
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus softwaremill/okapi
-
bug
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
softwaremill/okapi#141 ·
Maintainer antworten meist innerhalb von 1 Tag
-
OutboxProcessorListener events are emitted before the transaction commits; metrics over-count on commit failureEvtl. vergeben @rawo hat das heute übernommen. Offenbreaking-change bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
softwaremill/okapi#137 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 42/100
softwaremill/okapi#136 ·
Maintainer antworten meist innerhalb von 1 Tag
-
breaking-change bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
softwaremill/okapi#135 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 62/100
softwaremill/okapi#134 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in softwaremill/okapi
Ähnliche Issues
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
airbytehq/airbyte#91201 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug javascript
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Source: c7 Type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
2.23
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
ankidroid/Anki-Android#23042 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Submission] AI通话助手Offensubmit-adaption submit-adaption-pre
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
BetterAndroid/android-notification-icon-project#828 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag