fix(core): reconnect stale agent pools on JDBC errors
This commit is contained in:
5 files changed
+81
-12
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { shouldMarkDisconnected } from "@/lib/connection/connectionHealth";
|
||||
|
||||
describe("connectionHealth", () => {
|
||||
it("marks localized and JDBC communication errors as disconnected", () => {
|
||||
expect(shouldMarkDisconnected("Agent RPC error (-1): dm.jdbc.driver.DMException: 网络通信异常")).toBe(true);
|
||||
expect(shouldMarkDisconnected("Agent RPC error (-1): com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure")).toBe(true);
|
||||
expect(shouldMarkDisconnected("Agent RPC error (-1): java.sql.SQLRecoverableException: IO 错误: Got minus one from a read call")).toBe(true);
|
||||
});
|
||||
|
||||
it("does not mark ordinary SQL or authentication errors as disconnected", () => {
|
||||
expect(shouldMarkDisconnected("syntax error at or near SELECT")).toBe(false);
|
||||
expect(shouldMarkDisconnected("Access denied for user root")).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -24,6 +24,12 @@ const CONNECTION_ERROR_PATTERNS = [
|
||||
"input/output error",
|
||||
"关闭的连接",
|
||||
"连接已关闭",
|
||||
"网络通信异常",
|
||||
"通信异常",
|
||||
"communications link failure",
|
||||
"sqlrecoverableexception",
|
||||
"sqlnontransientconnectionexception",
|
||||
"sqltransientconnectionexception",
|
||||
"i/o error",
|
||||
"no route to host",
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user