Skip to content

When the server side is unexpectedly closed, the consumer cannot receive the error message and keeps sending heartbeats. #286

Open
@JiaYingZhang

Description

@JiaYingZhang

Describe the bug

When the server side is unexpectedly closed, the consumer cannot receive the error message and keeps sending heartbeats.

[2025-04-24T08:35:10Z TRACE rabbitmq_stream_client::consumer] Got delivery with messages 3
[2025-04-24T08:35:11Z TRACE rabbitmq_stream_client::consumer] Got delivery with messages 2
[2025-04-24T08:35:11Z TRACE rabbitmq_stream_client::consumer] Got delivery with messages 2
[2025-04-24T08:35:12Z TRACE rabbitmq_stream_client::consumer] Got delivery with messages 3
[2025-04-24T08:35:17Z TRACE rabbitmq_stream_client::client::dispatcher] Stream closed
[2025-04-24T08:35:17Z TRACE rabbitmq_stream_client::client] Closing client
[2025-04-24T08:35:17Z TRACE rabbitmq_stream_client::consumer] Closing consumer
[2025-04-24T08:35:23Z TRACE rabbitmq_stream_client::client] Sending heartbeat

I can solve this problem by monitoring whether the consumer is closed, but I want to confirm what the correct approach should be.

Reproduction steps

1.start consumer
2.close connection in server side
3.consumer.next() received anything and client keep send heartbeat.

The reason is that when item(MessageResult) is None, no content is sent to the sender.

// src/consumer.rs::impl MessageHandler for ConsumerMessageHandler::handle_message
            None => {
                trace!("Closing consumer");
                self.0.closed.store(true, Relaxed);
                self.0.waker.wake();
            }

Expected behavior

should I handle them myself or should the library provide a solution?

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions