{"record":{"id":"3893729a10aa7517","repo":"apache/seatunnel","slug":"rabbitmq-03","errorCode":"RABBITMQ-03","errorMessage":"Error while closing RMQ connection with queue %s at %s","messagePattern":"Error while closing RMQ connection with queue (.+?) at (.+?)","errorType":"error_code","errorClass":"RabbitmqConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-rabbitmq/src/main/java/org/apache/seatunnel/connectors/seatunnel/rabbitmq/client/RabbitmqClient.java","lineNumber":205,"sourceCode":"            }\n        } catch (IOException | TimeoutException e) {\n            t = e;\n        }\n\n        try {\n            if (connection != null && connection.isOpen()) {\n                connection.close();\n            }\n        } catch (IOException e) {\n            if (t != null) {\n                log.warn(\n                        \"Both channel and connection closing failed. Logging channel exception and failing with connection exception\",\n                        t);\n            }\n            t = e;\n        }\n        if (t != null) {\n            throw new RabbitmqConnectorException(\n                    CLOSE_CONNECTION_FAILED,\n                    String.format(\n                            \"Error while closing RMQ connection with queue %s at %s\",\n                            config.getQueueName(), config.getHost()),\n                    t);\n        }\n    }\n\n    /** Declare the queue using configuration defaults. */\n    public void setupQueue() throws IOException {\n        if (StringUtils.isNotEmpty(config.getQueueName())) {\n            declareQueueDefaults(channel, config);\n        }\n    }\n\n    /** Declare a specific queue */\n    public void setupQueue(String queueName) throws IOException {\n        if (StringUtils.isNotEmpty(queueName)) {","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-rabbitmq/src/main/java/org/apache/seatunnel/connectors/seatunnel/rabbitmq/client/RabbitmqClient.java#L187-L223","documentation":"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.","triggerScenarios":"connection.close() or channel.close() throws IOException/TimeoutException during job teardown — broker already down, socket dead, or close timed out.","commonSituations":"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.","solutions":["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","Increase the close timeout in the RabbitMQ client code if closes time out on slow networks","Verify network stability/firewall idle-connection cleanup between engine and broker; adjust TCP keepalive/heartbeat settings","If close fails after a successful job, treat it as a warning; ensure resources are ultimately released and inspect the wrapped cause"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  client.close();\n} catch (RabbitmqConnectorException e) {\n  // CLOSE_CONNECTION_FAILED: broker likely already gone; log and continue teardown\n  log.warn(\"RMQ close failed (connection may already be dead): {}\", e.getMessage(), e.getCause());\n}","preventionTips":["Treat close failures as secondary symptoms; investigate the original broker/network error","Set adequate heartbeat so dead connections are detected earlier","Avoid killing the broker before jobs finish draining"],"tags":["rabbitmq","network","resource-cleanup","connection"],"backgroundTag":"connection-closed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}