OutboxProcessorListener events are emitted before the transaction commits; metrics over-count on commit failure

Abierto
#137 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@rawo ya está trabajando en esto.

Desde el 6/11/2026.

  • #147 de @rawo — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
kafka, kotlin, mysql, postgresql, spring-boot
Área
backend

Línea de trabajo

Start in OutboxProcessor.processNext, where listener.onEntryProcessed runs right after store.updateAfterProcessingBatch and before the transaction commits. Then read OutboxScheduler and the TransactionRunner used around runInTransaction to see where an after-commit notification could go. Done means listener callbacks fire only after a successful commit, or the pre-commit behaviour is documented; the design choice needs maintainer input first.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

breaking-change bug

Severity: Low · Area: okapi-core OutboxProcessor listener notifications · Found in: code review of main @ e5630a1

Problem

OutboxProcessor.processNext calls listener.onEntryProcessed(...) (Delivered / RetryScheduled / Failed) right after store.updateAfterProcessingBatch, while still inside the scheduler's transaction, before it commits. If the commit then fails (connection loss, serialization failure, server-side timeout), the DB rolls back to PENDING, but okapi.entries.delivered and okapi.entries.failed have already been incremented. The rows are delivered again next tick and counted again.

Metrics therefore over-report successful deliveries in exactly the failure scenarios where operators rely on them. A custom listener that does something non-idempotent (e.g. notifying another system) would act on a state that was never persisted.

Suggested fix

Defer listener callbacks until after the transaction commits: for example, return the processed entries from the transactional block and notify in OutboxScheduler after runInTransaction returns, or register an after-commit hook through TransactionRunner. At minimum, document that events are pre-commit.

Lenguaje dominante
Kotlin
Estrellas
14
Forks
0
Merge medio
9 h 54 min
PR fusionados (30 d)
11

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de softwaremill/okapi

Todos los issues de softwaremill/okapi

Issues similares

Más issues de Kotlin

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.