Double ack breaks consumer connection.

88 views
Skip to first unread message

Dokiy

unread,
Mar 9, 2023, 5:05:16 AM3/9/23
to rabbitmq-users
Hi,
I'm new to rabbitmq. I follow this guide to start. But when I ack one msg twice, the connection is broken.
go func() {
  for d := range msgs {
    log.Printf("Received a message: %s", d.Body)
    dotCount := bytes.Count(d.Body, []byte("."))
    t := time.Duration(dotCount)
    time.Sleep(t * time.Second)
    log.Printf("Done")
    d.Ack(false)
    d.Ack(false) // What I add
  }
}()
And the logs are below, 
Docker Image: rabbitmq:3.11-management

2023-03-09 09:35:25.305009+00:00 [info] <0.867.0> started TCP listener on [::]:5672

 completed with 4 plugins.

2023-03-09 09:35:25.409005+00:00 [info] <0.722.0> Server startup complete; 4 plugins started.

2023-03-09 09:35:25.409005+00:00 [info] <0.722.0>  * rabbitmq_prometheus

2023-03-09 09:35:25.409005+00:00 [info] <0.722.0>  * rabbitmq_management

2023-03-09 09:35:25.409005+00:00 [info] <0.722.0>  * rabbitmq_web_dispatch

2023-03-09 09:35:25.409005+00:00 [info] <0.722.0>  * rabbitmq_management_agent

2023-03-09 09:35:56.529533+00:00 [info] <0.873.0> accepting AMQP connection <0.873.0> (172.17.0.1:57726 -> 172.17.0.2:5672)

2023-03-09 09:35:56.542303+00:00 [info] <0.873.0> connection <0.873.0> (172.17.0.1:57726 -> 172.17.0.2:5672): user 'user' authenticated and granted access to vhost '/'

2023-03-09 09:36:00.930539+00:00 [info] <0.891.0> accepting AMQP connection <0.891.0> (172.17.0.1:57728 -> 172.17.0.2:5672)

2023-03-09 09:36:00.947398+00:00 [info] <0.891.0> connection <0.891.0> (172.17.0.1:57728 -> 172.17.0.2:5672): user 'user' authenticated and granted access to vhost '/'

2023-03-09 09:36:00.960565+00:00 [info] <0.891.0> closing AMQP connection <0.891.0> (172.17.0.1:57728 -> 172.17.0.2:5672, vhost: '/', user: 'user')

2023-03-09 09:36:01.968325+00:00 [error] <0.882.0> Channel error on connection <0.873.0> (172.17.0.1:57726 -> 172.17.0.2:5672, vhost: '/', user: 'user'), channel 1:

2023-03-09 09:36:01.968325+00:00 [error] <0.882.0> operation basic.ack caused a channel exception precondition_failed: unknown delivery tag 1

2023-03-09 09:36:50.713288+00:00 [warning] <0.873.0> closing AMQP connection <0.873.0> (172.17.0.1:57726 -> 172.17.0.2:5672, vhost: '/', user: 'user'):

2023-03-09 09:36:50.713288+00:00 [warning] <0.873.0> client unexpectedly closed TCP connection

Reply all
Reply to author
Forward
0 new messages