apache/seatunnel · error · RabbitmqConnectorException

RABBITMQ-03

RABBITMQ-03

Error message

Error while closing RMQ connection with queue %s at %s

What it means

RabbitmqClient.close throws RabbitmqConnectorException(CLOSE_CONNECTION_FAILED) when closing the RabbitMQ channel and/or connection fails. It attempts to close the channel then the connection, logs a channel failure but fails with the connection error, wrapping the last throwable.

Source

Thrown at seatunnel-connectors-v2/connector-rabbitmq/src/main/java/org/apache/seatunnel/connectors/seatunnel/rabbitmq/client/RabbitmqClient.java:205

            }
        } catch (IOException | TimeoutException e) {
            t = e;
        }

        try {
            if (connection != null && connection.isOpen()) {
                connection.close();
            }
        } catch (IOException e) {
            if (t != null) {
                log.warn(
                        "Both channel and connection closing failed. Logging channel exception and failing with connection exception",
                        t);
            }
            t = e;
        }
        if (t != null) {
            throw new RabbitmqConnectorException(
                    CLOSE_CONNECTION_FAILED,
                    String.format(
                            "Error while closing RMQ connection with queue %s at %s",
                            config.getQueueName(), config.getHost()),
                    t);
        }
    }

    /** Declare the queue using configuration defaults. */
    public void setupQueue() throws IOException {
        if (StringUtils.isNotEmpty(config.getQueueName())) {
            declareQueueDefaults(channel, config);
        }
    }

    /** Declare a specific queue */
    public void setupQueue(String queueName) throws IOException {
        if (StringUtils.isNotEmpty(queueName)) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check broker status/logs to see why the connection was already gone when close ran; this is usually a secondary symptom of an earlier failure
  2. Increase the close timeout in the RabbitMQ client code if closes time out on slow networks
  3. Verify network stability/firewall idle-connection cleanup between engine and broker; adjust TCP keepalive/heartbeat settings
  4. If close fails after a successful job, treat it as a warning; ensure resources are ultimately released and inspect the wrapped cause
Defensive patterns

Strategy: try-catch

Try / catch

try {
  client.close();
} catch (RabbitmqConnectorException e) {
  // CLOSE_CONNECTION_FAILED: broker likely already gone; log and continue teardown
  log.warn("RMQ close failed (connection may already be dead): {}", e.getMessage(), e.getCause());
}

Prevention

When it happens

Trigger: connection.close() or channel.close() throws IOException/TimeoutException during job teardown — broker already down, socket dead, or close timed out.

Common situations: RabbitMQ broker crashed or was restarted before the sink finished; network interruption at end of job; forceful kill of broker causing lingering dead sockets that make close() time out.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/3893729a10aa7517. Report an issue: GitHub.