apache/seatunnel · warning · RuntimeException
Failed to invoke ${clazz.getName()}.${methodName}()
Error message
Failed to invoke ${clazz.getName()}.${methodName}() What it means
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.
Source
Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/error/DefaultErrorSinkWriter.java:597
if (invokeStaticNoArgIfExists(cleanupClass, "uncheckedShutdown")) {
return;
}
invokeStaticNoArgIfExists(cleanupClass, "shutdown");
}
private boolean invokeStaticNoArgIfExists(Class<?> clazz, String methodName) {
Method method;
try {
method = clazz.getDeclaredMethod(methodName);
} catch (NoSuchMethodException e) {
return false;
}
try {
method.setAccessible(true);
method.invoke(null);
return true;
} catch (ReflectiveOperationException e) {
throw new RuntimeException(
"Failed to invoke " + clazz.getName() + "." + methodName + "()", e);
}
}
private void waitForWorkerTermination(long timeoutMillis) {
if (workerThread == null) {
return;
}
if (!workerThread.isAlive()) {
return;
}
try {
workerThread.join(timeoutMillis);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
log.warn("Interrupted while waiting for error sink worker to close");
}
View on GitHub (pinned to cf67b549a7)
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
Defensive patterns
Strategy: try-catch
Validate before calling
try {
Class.forName("com.mysql.cj.jdbc.AbandonedConnectionCleanupThread")
.getMethod("shutdown");
} catch (ClassNotFoundException | NoSuchMethodException e) {
LOG.warn("MySQL cleanup-thread shutdown not available in this driver version");
} Try / catch
try {
writer.close();
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Failed to invoke")) {
LOG.warn("Non-critical reflection failure during shutdown", e);
// treat as warning; cleanup-thread leak is benign
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.
Related errors
- Error sink is closing for stage [%s], plugin [%s]
- Failed to call factoryIdentifier method.
- close event processor error
- Error sink previously failed for stage [%s], plugin [%s]
- Error queue overflow for stage [%s], plugin [%s]
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/5e573e6359e4b4cc.
Report an issue: GitHub.