{"record":{"id":"629d13b22e62a8ff","repo":"apache/seatunnel","slug":"close-connection-failed","errorCode":"CLOSE_CONNECTION_FAILED","errorMessage":"Error while closing AMQ connection with  %s","messagePattern":"Error while closing AMQ connection with  (.+?)","errorType":"error_code","errorClass":"ActivemqConnectorException","httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-activemq/src/main/java/org/apache/seatunnel/connectors/seatunnel/activemq/client/ActivemqClient.java","lineNumber":141,"sourceCode":"            producer.send(objectMessage);\n\n        } catch (JMSException e) {\n            throw new ActivemqConnectorException(\n                    ActivemqConnectorErrorCode.SEND_MESSAGE_FAILED,\n                    String.format(\n                            \"Cannot send AMQ message %s at %s\",\n                            config.get(QUEUE_NAME), config.get(CLIENT_ID)),\n                    e);\n        }\n    }\n\n    public void close() {\n        try {\n            if (connection != null) {\n                connection.close();\n            }\n        } catch (JMSException e) {\n            throw new ActivemqConnectorException(\n                    ActivemqConnectorErrorCode.CLOSE_CONNECTION_FAILED,\n                    String.format(\n                            \"Error while closing AMQ connection with  %s\", config.get(QUEUE_NAME)));\n        }\n    }\n\n    private Connection createConnection(ReadonlyConfig config) throws JMSException {\n        if (config.get(USERNAME) != null && config.get(PASSWORD) != null) {\n            return connectionFactory.createConnection(config.get(USERNAME), config.get(PASSWORD));\n        }\n        return connectionFactory.createConnection();\n    }\n}\n","sourceCodeStart":123,"sourceCodeEnd":155,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-activemq/src/main/java/org/apache/seatunnel/connectors/seatunnel/activemq/client/ActivemqClient.java#L123-L155","documentation":"ActivemqClient.close closes the underlying JMS connection; if connection.close() throws a JMSException it is wrapped as CLOSE_CONNECTION_FAILED. This happens during sink cleanup at the end of a task; it usually signals an already-broken connection rather than lost data.","triggerScenarios":"Calling close() when the JMS connection has already been dropped or the broker is unreachable, so connection.close() throws JMSException; config.get(QUEUE_NAME) is interpolated into the message.","commonSituations":"Broker went away before job teardown; network partition during job shutdown; close called twice after a prior failure invalidated the connection.","solutions":["Check whether the broker was still up at job shutdown; fix underlying connectivity first","Inspect the original exception logged before this error for the root cause","Treat as secondary — if data was written successfully, this error mainly affects clean shutdown","Upgrade connector version if close-on-dead-connection noise is recurring"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { writer.close(); } catch (ActivemqConnectorException e) { if (e.getErrorCode() == CLOSE_CONNECTION_FAILED) { log.warn(\"AMQ close failed; connection likely already dead\", e); } }","preventionTips":["Treat close failures as secondary; investigate the primary error logged first","Check broker uptime at job teardown window","Avoid double-closing clients","Use failover transport to reduce dead-connection noise"],"tags":["activemq","jms","close","cleanup"],"backgroundTag":"connection-refused","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"}