Skip to content

Kafka: a user SetErrorHandler silently disables Wolverine's connection-state tracking; warn, or compose the handlers #4522

Description

@jeremydmiller

Kafka/Wolverine.Kafka/Internals/KafkaTransport.cs:387-391: Wolverine installs consumerBuilder.SetErrorHandler(...) to feed its connection-state tracker. If the user already registered an error handler through ConfigureConsumers(...), Confluent's builder throws InvalidOperationException (a handler may be set once), Wolverine catches it and sets tracker.ErrorHandlerSuppressed = true — silently. From then on the transport's connection state never leaves Unknown: health checks, wolverine-diagnostics, and CritterWatch cannot tell a healthy Kafka consumer from one that has been disconnected for an hour.

Ask

  • Log at Warning when the handler is suppressed, naming the consequence: "A consumer error handler was already registered through ConfigureConsumers(), so Wolverine cannot observe Kafka connection errors for {Uri}. Connection state will report Unknown. Chain Wolverine's handler from yours, or drop the custom handler."
  • Better: expose a hook so a user handler can be composed rather than replace Wolverine's (wrap the user's delegate and call both).
  • Related silences worth a warning-level line each, since they are the answers to "why are messages being redelivered": offset-commit failures are logged at Warning and swallowed (Internals/KafkaOffsetCommitter.cs:307), and UseKafka sets EnableAutomaticFailureAcks = false with no log at all.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions