fix(serverust-events): silent Kafka ack loss and SQS DLQ redelivery loop - #22
Conversation
…SQS Lambda - EventRouter::with_dlq retorna Ok após publish bem-sucedido no DLQ (alinha com DlqLayer; evita redelivery infinito no Lambda ESM) - LambdaBroker e KafkaBroker::dispatch erram quando não há handler inscrito, em vez de no-op que commitaria offset/ack implicitamente - Testes de regressão para os três caminhos Co-authored-by: Jaime Basso <JaimeJunr@users.noreply.github.com>
…kers Default WarnAndIgnore preserves 0.3.x skip (now with tracing::warn!). Error returns BrokerError::Subscribe with received and registered topics. EventRouter logs handler+DLQ errors via tracing::error! when DLQ publish fails, instead of eprintln! of the DLQ error only. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…-events Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Revisado e ajustado. O bug 1 (loop de redelivery na DLQ) era correção pura e ficou como estava. Os bugs 2 e 3 foram reescritos como política configurável, porque o comportamento que o PR removia não era acidental — ignorar record de tópico sem handler estava documentado no doc comment e coberto por teste em Mudanças
Aplicado em Lacuna do bug 1 fechada: quando o publish na DLQ falha, o erro ia só pra Nota de dependência: Validação local (por crate, serial):
🤖 Generated with Claude Code |
Conflito de CHANGELOG resolvido por união: Added do PR mais os itens de Changed dos dois lados. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Conflito de CHANGELOG resolvido por união das duas entradas em Fixed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Summary
Weekly critical-bug scan found three high-severity correctness issues in
serverust-events(beyond the already-merged SQS silent-ack and backoff panic fixes).Bugs fixed
1. EventRouter DLQ + Lambda SQS — infinite redelivery
Impact: After retries exhaust and DLQ publish succeeds,
wrap_with_retrystill returnedErr, soSqsBrokerreportedbatchItemFailuresand Lambda never deleted the source message — poison-message loop with duplicate DLQ writes.Root cause:
DlqLayerreturnsOk(())after successful DLQ routing;EventRouterdid not.Fix: Return
Ok(())whenbroker.publish(dlq_topic, …)succeeds.2. LambdaBroker — silent Kafka message loss
Impact: Records whose topic had no subscribed handler were skipped while the invocation returned
Ok(()), causing Lambda to commit offsets without processing.Root cause:
continueon empty handler list (pre-#12 SQS analogue).Fix: Return
BrokerError::Subscribewhen no handler is registered for the record topic.3. KafkaBroker::dispatch — silent no-op
Impact: Same class as (2) for long-running consumers that commit offset on
Ok(()).Fix: Return error when no handlers match
msg.topic.Validation
cargo test -p serverust-events --features sqs --test sqs_consumer --test lambda_brokercargo test -p serverust-events --features "sqs in-memory" --test retry_policyNot fixed (lower confidence / larger change)
subscribe_publish+with_retryre-runs user handler when only publish fails (duplicate side effects) — needs publish-only retry split.Changelog
Updated
[Unreleased]with the three fixes.