The RabbitMQ lifecycle test fails when the broker container resets the first connection after its port opens #414

Closed
opened 2026-11-13 03:18:46 -05:00 by claude · 0 comments
Owner

What happened

RabbitMqConnectionLifecycleTests.RemoveShutdownHandler_OnADisposedConnection_DoesNotThrow failed once on the Linux runner, in the Test .NET job of the pull-request run 1544 (PR #410, a change to the release script and CONTRIBUTING.md that touches no .NET code):

RabbitMQ.Client.Exceptions.BrokerUnreachableException : None of the specified endpoints were reachable
---- System.IO.IOException : connection.start was never received, likely due to a network timeout
-------- System.IO.IOException : Unable to read data from the transport connection: Connection reset by peer.
   at RabbitMQ.Client.ConnectionFactory.CreateConnectionAsync(...)
   at ...RabbitMqConnectionLifecycleTests.RemoveShutdownHandler_OnADisposedConnection_DoesNotThrow() in RabbitMqConnectionLifecycleTests.cs:line 156

The test failed after 20 ms, so nothing timed out: the broker's port accepted the connection and reset it. The runner's load average was about 30.

Likely cause (not proven)

The class starts one RabbitMQ container per test and waits with Wait.ForUnixContainer().UntilInternalTcpPortIsAvailable(5672). That only says something listens on the port inside the container. It does not say the broker answers an AMQP handshake, and the test connects through the mapped host port, which the Docker proxy accepts on its own.

The other two tests in the class go through RabbitMqDnsServerEventBrokerTransport, which reconnects, or poll until the transport is connected. This test, and the admin connection in Connect_WhenTheExchangeDeclarationIsRefused_DoesNotLeaveConnectionsOpen, call ConnectionFactory.CreateConnectionAsync() once with no retry.

Wanted

  • The container counts as started only when the broker accepts AMQP clients (for example a wait strategy that runs a rabbitmq-diagnostics check inside the container, or waits for the broker's "startup complete" log line; pick what the reading of the image supports and say why in a comment).
  • The first direct connection of a test does not depend on a single attempt if the reading shows the wait strategy alone cannot guarantee it.
  • Test code only. The test keeps the RequiresDocker trait.

Related: #406, #402, #396 (other tests that failed only on a loaded runner).

**What happened** `RabbitMqConnectionLifecycleTests.RemoveShutdownHandler_OnADisposedConnection_DoesNotThrow` failed once on the Linux runner, in the Test .NET job of the pull-request run 1544 (PR #410, a change to the release script and CONTRIBUTING.md that touches no .NET code): ``` RabbitMQ.Client.Exceptions.BrokerUnreachableException : None of the specified endpoints were reachable ---- System.IO.IOException : connection.start was never received, likely due to a network timeout -------- System.IO.IOException : Unable to read data from the transport connection: Connection reset by peer. at RabbitMQ.Client.ConnectionFactory.CreateConnectionAsync(...) at ...RabbitMqConnectionLifecycleTests.RemoveShutdownHandler_OnADisposedConnection_DoesNotThrow() in RabbitMqConnectionLifecycleTests.cs:line 156 ``` The test failed after 20 ms, so nothing timed out: the broker's port accepted the connection and reset it. The runner's load average was about 30. **Likely cause (not proven)** The class starts one RabbitMQ container per test and waits with `Wait.ForUnixContainer().UntilInternalTcpPortIsAvailable(5672)`. That only says something listens on the port inside the container. It does not say the broker answers an AMQP handshake, and the test connects through the mapped host port, which the Docker proxy accepts on its own. The other two tests in the class go through `RabbitMqDnsServerEventBrokerTransport`, which reconnects, or poll until the transport is connected. This test, and the `admin` connection in `Connect_WhenTheExchangeDeclarationIsRefused_DoesNotLeaveConnectionsOpen`, call `ConnectionFactory.CreateConnectionAsync()` once with no retry. **Wanted** - The container counts as started only when the broker accepts AMQP clients (for example a wait strategy that runs a `rabbitmq-diagnostics` check inside the container, or waits for the broker's "startup complete" log line; pick what the reading of the image supports and say why in a comment). - The first direct connection of a test does not depend on a single attempt if the reading shows the wait strategy alone cannot guarantee it. - Test code only. The test keeps the `RequiresDocker` trait. Related: #406, #402, #396 (other tests that failed only on a loaded runner).
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil#414
No description provided.