rabbitmq / rabbitmq/rabbitmq-java-client

Channels that have had exceptions but not explicitly closed can be recovered via connection recovery

Open
#1,085 3 comments 0 reactions 1 assignee View on GitHub

@lukebakken is already working on this.

Since Oct 12, 2023.

bug
Dominant language
Java
Stars
1.3k
Forks
587
Avg merge
7h 29m
Merged PRs (30d)
41

Description

Describe the bug

Reported here: https://groups.google.com/g/rabbitmq-users/c/lhLt0pkCFv4


Observed the following and wondering if it is expected or considered to be a possible issue.

Using Java 5.13.1 rabbitmq client library against RabbitMQ 3.11.18 Erlang 25.3.2.2 cluster.

Testing several recovery scenarios, specifically the documented behavior "Channel-level exceptions will not trigger any kind of recovery as they usually indicate a semantic issue in the application (e.g. an attempt to consume from a non-existent queue)."

In my test:

  • Allocate auto-recovering connection
  • Allocate channel from the connection
  • basicConsume() from a busy queue
  • Deliberately app-error the channel closed so it won't autorecover (in my case I called basicAck() with an invalid msg id on the channel)
  • As expected, consumption stops, incoming events to the queue do not fire consumer callbacks

What surprised me:

With my app in the above state, in the Rabbit UI, I performed a "Force Close" of the connection. When the connection recovered, it also recovered the channel and consumer callbacks started firing again with new events.

I had not explicitly closed the channel after the application error since I assumed it to be closed "underneath" me, and it did not recover as long as its parent connection remained stable. But when the parent connection was forced to recover it did recover the channel closed by protocol error which seems to go against the documentation.

Reproduction steps

See above.

Expected behavior

The documentation should be changed to reflect this edge case.

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.