{"record":{"id":"06b0f665e08c40aa","repo":"MyCATApache/Mycat-Server","slug":"errr","errorCode":null,"errorMessage":" errr","messagePattern":" errr","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/net/AbstractConnection.java","lineNumber":533,"sourceCode":"\n\t@Override\n\tpublic void close(String reason) {\n\t\tif (!isClosed.get()) {\n\t\t\tcloseSocket();\n\t\t\tisClosed.set(true);\n\t\t\tif (processor != null) {\n\t\t\t\tprocessor.removeConnection(this);\n\t\t\t}\n\t\t\tthis.cleanup();\n\t\t\tisSupportCompress = false;\n\n\t\t\t// ignore null information\n\t\t\tif (Strings.isNullOrEmpty(reason)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tLOGGER.info(\"close connection,reason:\" + reason + \" ,\" + this);\n\t\t\tif (reason.contains(\"connection,reason:java.net.ConnectException\")) {\n\t\t\t\tthrow new RuntimeException(\" errr\");\n\t\t\t}\n\t\t} else {\n\t\t    // make sure cleanup again\n\t\t    // Fix issue#1616\n\t\t    this.cleanup();\n\t\t}\n\t}\n\n\tpublic boolean isClosed() {\n\t\treturn isClosed.get();\n\t}\n\n\tpublic void idleCheck() {\n\t\tif (isIdleTimeout()) {\n\t\t\tLOGGER.info(toString() + \" idle timeout\");\n\t\t\tclose(\" idle \");\n\t\t}\n\t}","sourceCodeStart":515,"sourceCodeEnd":551,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/net/AbstractConnection.java#L515-L551","documentation":"In the close(reason) path, AbstractConnection detects that the close reason string itself contains 'connection,reason:java.net.ConnectException' — i.e. a nested/recursive close with a ConnectException reason — and throws RuntimeException(\" errr\") as a debug guard. It indicates the connection is being closed because a backend connect failed.","triggerScenarios":"close(String reason) is invoked with a reason produced by a previous failed close containing 'java.net.ConnectException', typically when mycat cannot establish a TCP connection to a backend MySQL node.","commonSituations":"Backend MySQL down or wrong host/port in schema.xml/dataHost config; firewall blocking the port; DNS failure; backend pool exhausted and connect refused during failover.","solutions":["Fix backend connectivity: verify dataHost url host/port, that MySQL is running, and reachable (telnet/nc the port).","Correct schema.xml dataNode/dataHost configuration and reload config.","Check firewalls/security groups between mycat and the MySQL nodes.","If this is a cascaded close (double close), fix the caller that closes twice; upgrade mycat where double-close cleanup was fixed (e.g. issue#1616 style fixes)."],"exampleFix":"// before (schema.xml)\n<writeHost host=\"hostM1\" url=\"10.0.0.3:3307\" .../>\n// after\n<writeHost host=\"hostM1\" url=\"10.0.0.3:3306\" .../>","handlingStrategy":"retry","validationCode":"// probe backend before routing requests\ntry (Socket s = new Socket()) {\n    s.connect(new InetSocketAddress(host, port), 3000); // must succeed\n}","typeGuard":null,"tryCatchPattern":"try {\n    conn.close(reason);\n} catch (RuntimeException e) {\n    if (\" errr\".equals(e.getMessage())) {\n        LOGGER.error(\"backend connect failed; verify dataHost {}:{}\", host, port);\n    }\n}","preventionTips":["Health-check MySQL backends and keep schema.xml hosts/ports correct","Alert on mycat connect logs (java.net.ConnectException)","Avoid double-closing connections; centralize close logic"],"tags":["connection","connect-exception","backend","network"],"backgroundTag":"connection-refused","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}