{"record":{"id":"5e573e6359e4b4cc","repo":"apache/seatunnel","slug":"failed-to-invoke-clazz-getname-methodname","errorCode":null,"errorMessage":"Failed to invoke ${clazz.getName()}.${methodName}()","messagePattern":"Failed to invoke (.+?)\\.(.+?)\\(\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/error/DefaultErrorSinkWriter.java","lineNumber":597,"sourceCode":"        if (invokeStaticNoArgIfExists(cleanupClass, \"uncheckedShutdown\")) {\n            return;\n        }\n        invokeStaticNoArgIfExists(cleanupClass, \"shutdown\");\n    }\n\n    private boolean invokeStaticNoArgIfExists(Class<?> clazz, String methodName) {\n        Method method;\n        try {\n            method = clazz.getDeclaredMethod(methodName);\n        } catch (NoSuchMethodException e) {\n            return false;\n        }\n        try {\n            method.setAccessible(true);\n            method.invoke(null);\n            return true;\n        } catch (ReflectiveOperationException e) {\n            throw new RuntimeException(\n                    \"Failed to invoke \" + clazz.getName() + \".\" + methodName + \"()\", e);\n        }\n    }\n\n    private void waitForWorkerTermination(long timeoutMillis) {\n        if (workerThread == null) {\n            return;\n        }\n        if (!workerThread.isAlive()) {\n            return;\n        }\n        try {\n            workerThread.join(timeoutMillis);\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            log.warn(\"Interrupted while waiting for error sink worker to close\");\n        }\n","sourceCodeStart":579,"sourceCodeEnd":615,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/error/DefaultErrorSinkWriter.java#L579-L615","documentation":"RuntimeException thrown by invokeStaticNoArgIfExists when reflective invocation of a static no-arg method on a class (used by shutdownMySqlAbandonedConnectionCleanupThreadIfPresent to silence MySQL's cleanup thread) fails with a ReflectiveOperationException. The target class and method name are embedded in the message and the reflective exception is the cause.","triggerScenarios":"During error-sink worker shutdown, the writer looks up a static no-arg method (e.g. com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.shutdown) and either setAccessible or invoke fails: method not public/absent in the loaded MySQL driver version, security manager denial, or the class loader rejected access.","commonSituations":"MySQL connector version where AbandonedConnectionCleanupThread API changed (older drivers lack shutdown()); shaded/bundled MySQL driver with restricted access; running under a security policy blocking setAccessible.","solutions":["Check the cause: if NoSuchMethodException-like, upgrade/downgrade the MySQL JDBC driver so the target method exists","Verify the driver jar is complete and unshaded/correctly shaded","Run without a restrictive SecurityManager or grant reflection permissions","If only cleanup-related, this failure is mostly cosmetic - report/patch to tolerate missing methods"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"try {\n    Class.forName(\"com.mysql.cj.jdbc.AbandonedConnectionCleanupThread\")\n        .getMethod(\"shutdown\");\n} catch (ClassNotFoundException | NoSuchMethodException e) {\n    LOG.warn(\"MySQL cleanup-thread shutdown not available in this driver version\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    writer.close();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Failed to invoke\")) {\n        LOG.warn(\"Non-critical reflection failure during shutdown\", e);\n        // treat as warning; cleanup-thread leak is benign\n    }\n}","preventionTips":["Pin a MySQL driver version that supports AbandonedConnectionCleanupThread.shutdown()","Avoid double-shading the MySQL driver","Run without a SecurityManager restricting reflection","Skip cleanup hacks when the driver version is unknown"],"tags":["reflection","mysql","shutdown","error-sink","zeta-engine"],"backgroundTag":"deprecated-api-usage","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}